Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.0.0 Beta 2
-
None
-
Windows 7, Qt5 beta2, VC++.
-
12775b817f4e9f9053b4ea677910dd4101971959
Description
When I dragging the mouse over the QPushButton in MS Windows7 (32 and 64bit) my app eats some memory. More moves - more memory used.
But if I close the widget where the buttons are then memory will be freed, so it's not a simple leak.
In my test app I'm dragging the mouse over the buttons about 10 minutes and memory grows up to ~500MB.
When I'm using another QStyle (QWindowsStyle), it does not happens.
test app
//-- widget1.h class Widget1 : public QWidget { Q_OBJECT private: void callWidget2(); public: Widget1(QWidget* parent = 0); ~Widget1() {} }; //-- widget1.cpp Widget1::Widget1(QWidget* parent) :QWidget(parent) { QPushButton* btn = new QPushButton(this); btn->setText("show widget2"); connect(btn, &QPushButton::clicked, this, &Widget1::callWidget2); this->resize(100, 100); this->show(); } void Widget1::callWidget2() { new Widget2(); } //-- widget2.h class Widget2 : public QWidget { Q_OBJECT private: public: Widget2(QWidget* parent = 0); ~Widget2() {} }; //-- widget2.cpp Widget2::Widget2(QWidget* parent) :QWidget(parent) { this->setAttribute(Qt::WA_DeleteOnClose); this->resize(300, 300); QPushButton* button = new QPushButton(this); button->setText("btn1"); button = new QPushButton(this); button->setText("btn2"); button->move(0, 20); button = new QPushButton(this); button->setText("btn3"); button->move(0, 40); button = new QPushButton(this); button->setText("btn4"); button->move(0, 60); button = new QPushButton(this); button->setText("btn5"); button->move(0, 80); this->show(); } //-- main.cpp int main(int argc, char *argv[]) { QApplication a(argc, argv); //a.setStyle(new QWindowsStyle); // it solves the problem but looks bad. new Widget1; return a.exec(); }