Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.7.1
-
None
-
Windows
-
5a24211e0dab76b61a1631f0959274927ffe929d (4.8)
Description
The test case which can reproduce the code is shown below. I have not been able to reproduce this on Windows 7.
/** In some cases the QRollEffect created to manage the "scroll" opening effect on a QCombobox may remain on screen, and not been deleted. I've not tried to create a small test case, but from the code, it happens when the QCombobox is deleted before the listview got his expected size. The issue is likely to be in : void QRollEffect::scroll() deleteLater is called in case "done" is true, but "done" is set to true only if "widget", a QPointer to the owner, is not null. So in case the widget is deleted very quickly, deleteLater will never be called, and the QRollEffect remains on screen. So either the QRollEffect takes the widget as parent instead of 0, or the "scroll" function is changed to take into account that the widget may be deleted. I found a dirty workaround: using QApplication::topLevelWidget list, I get the QRollEffect after showPopup, then I can hide it when deleting the QCombobox (I can't delete it because q_roll, the static pointer of qeffect.cpp, is not updated correctly, so it crashes). So if you would have a jira bug id (did not find anything related to QRollEffect), it would be nice. */ #include <QtGui> //Top slow the system down "a bit" class MyThread : public QThread { public: void run(); }; void MyThread::run() { long i; for (i = 0 ; i < 762334549; i++) { long count = i * 33; } qDebug() << QString("loop has finished and went around %1 times.").arg(i); } class MyWidget: public QWidget { Q_OBJECT public: MyWidget(QWidget *parent = 0); public slots: void doSomething(); private: QHBoxLayout *layout; QPushButton *button; QComboBox *combo; MyThread brakes; }; MyWidget::MyWidget(QWidget *parent) { setWindowTitle("Support Tester"); layout = new QHBoxLayout; button = new QPushButton ("Do Something"); layout->addWidget(button); combo = new QComboBox (this); layout->addWidget(combo); QStringList items; for (int i = 0 ; i < 49900; i++) { items << QString("%1").arg(i); } combo->addItems(items); setLayout(layout); QObject::connect(button, SIGNAL(clicked()), this, SLOT(doSomething())); } void MyWidget::doSomething() { qDebug() << QString("starting thread."); brakes.start(); qDebug() << QString("thread started, showing Popup."); combo->showPopup(); qDebug() << QString("popup shown,"); combo->setCurrentIndex(combo->count() - 10); qDebug() << QString("index changed."); delete combo; qDebug() << QString("deleting combo box."); } #include "main.moc" int main(int argc, char *argv[]) { QApplication app(argc, argv); MyWidget *myWin = new MyWidget(); myWin->show(); myWin->doSomething(); return app.exec(); }