QPushButton::setIcon produces memory leaks
-
Hi all,
I have found a possible bug.
When using the QPushButton::setIcon() function multiple times the memory is increasing with Qt 5.8 on Windows 10.
I checked some cases with my little test program here. To see the effect I called the slot multiple times with a timer.MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QTimer* timer = new QTimer( this ); connect( timer, SIGNAL(timeout()), this, SLOT(onTimeout())); timer->start( 10 ); } void MainWindow::onTimeout() { ui->pushButton->setIcon( QIcon( ":/images/icon.png" ) ); }
I analyzed some cases:
This is working with Qt 4.8 but not with 5.8:
With Qt 5.8 memory is increasing with 200 kb/s.ui->pushButton->setIcon( QIcon( ":/images/icon.png" ) );
This is working on Qt 4.8 and 5.8 (no memory leaks):
ui->pushButton->setIcon( QIcon( QPixmap( ":/images/icon.png" ) ) );
I used Qt 4.8 with msvc2008.
I used Qt 5.8 with msvc2015 and mingw. Both same behavior.
Can someone confirm this?regards
Oliver -
Hi
Can you link to the complete test project ?
So we use same icons etc. -
My test project:
https://www.file-upload.net/download-12297594/TestGUI.7z.html -
Win 7, mingw Qt5.7.1
Also see 200 kb increase. pr tick.
But it never went over 40k. even running for long time.
So not leak in 5.7