summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2009-06-22 12:58:48 (GMT)
committerjasplin <qt-info@nokia.com>2009-06-22 13:09:28 (GMT)
commit938592604e3689f4369d5babd2387ec8af8839bb (patch)
tree8d8b8b87da5867466e6137fa3cda0a00d6d4f17f /tests
parentab3a7760008ed6723f978a06aa52bee57b34d68d (diff)
downloadQt-938592604e3689f4369d5babd2387ec8af8839bb.zip
Qt-938592604e3689f4369d5babd2387ec8af8839bb.tar.gz
Qt-938592604e3689f4369d5babd2387ec8af8839bb.tar.bz2
Prevented QWizard from crashing upon removing a page after deleting a field object.
QWizard crashed when removing a page after deleting an object that was already registered as a field for the page. This patch prevents such a crash by doing the necessary cleanup immediately when the object is deleted. QWizard::removePage() will then see a consistent state in this case. Reviewed-by: janarve Task-number: 255350
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qwizard/tst_qwizard.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qwizard/tst_qwizard.cpp b/tests/auto/qwizard/tst_qwizard.cpp
index 71e1c3e..e5074b3 100644
--- a/tests/auto/qwizard/tst_qwizard.cpp
+++ b/tests/auto/qwizard/tst_qwizard.cpp
@@ -112,6 +112,7 @@ private slots:
void task161658_alignments();
void task177022_setFixedSize();
void task248107_backButton();
+ void task255350_fieldObjectDestroyed();
/*
Things that could be added:
@@ -2517,5 +2518,26 @@ void tst_QWizard::task248107_backButton()
QCOMPARE(wizard.currentPage(), &page1);
}
+class WizardPage_task255350 : public QWizardPage
+{
+public:
+ QLineEdit *lineEdit;
+ WizardPage_task255350()
+ : lineEdit(new QLineEdit)
+ {
+ registerField("dummy*", lineEdit);
+ }
+};
+
+void tst_QWizard::task255350_fieldObjectDestroyed()
+{
+ QWizard wizard;
+ WizardPage_task255350 *page = new WizardPage_task255350;
+ int id = wizard.addPage(page);
+ delete page->lineEdit;
+ wizard.removePage(id); // don't crash!
+ delete page;
+}
+
QTEST_MAIN(tst_QWizard)
#include "tst_qwizard.moc"