summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-11-20 10:34:22 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-11-20 10:38:50 (GMT)
commitf8fb064d6b2ad55c66ce1a481e7f829278051fcb (patch)
treef9757d37597cd9836a080c979899fd7a5417b49e /tests
parent8fb9ed08c60b667737a9ae1b209da61fe9c67200 (diff)
downloadQt-f8fb064d6b2ad55c66ce1a481e7f829278051fcb.zip
Qt-f8fb064d6b2ad55c66ce1a481e7f829278051fcb.tar.gz
Qt-f8fb064d6b2ad55c66ce1a481e7f829278051fcb.tar.bz2
avoid possible crash when showing a modal dialog from a widget destructor
Task-number: QTBUG-5804 Reviewed-by: denis
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 9692c6e..1e3f5f8 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -384,6 +384,8 @@ private slots:
void activateWindow();
+ void openModal_taskQTBUG_5804();
+
#ifdef Q_OS_SYMBIAN
void cbaVisibility();
#endif
@@ -9583,6 +9585,29 @@ void tst_QWidget::activateWindow()
QTRY_VERIFY(!mainwindow2->isActiveWindow());
}
+void tst_QWidget::openModal_taskQTBUG_5804()
+{
+ class Widget : public QWidget
+ {
+ public:
+ Widget(QWidget *parent) : QWidget(parent)
+ {
+ }
+ ~Widget()
+ {
+ QMessageBox msgbox;
+ QTimer::singleShot(10, &msgbox, SLOT(accept()));
+ msgbox.exec(); //open a modal dialog
+ }
+ };
+
+ QWidget *win = new QWidget;
+ new Widget(win);
+ win->show();
+ QTest::qWaitForWindowShown(win);
+ delete win;
+}
+
#ifdef Q_OS_SYMBIAN
void tst_QWidget::cbaVisibility()
{