diff options
author | André Somers <andre.somers@kdab.com> | 2016-10-25 16:27:58 +0200 |
---|---|---|
committer | Andre Somers <andre.somers@kdab.com> | 2016-10-28 14:11:42 +0000 |
commit | 4c00246fea63c348a2992f5a54499f2928bf0605 (patch) | |
tree | a3b32ae5304f2034ecd487f33d2ba897f43442a3 /tests/auto/widgets/widgets/qmainwindow | |
parent | dbf35d75714fac1e836e697650e32365a2a3493e (diff) |
Fixed crash taking null central widget
When no central widget has been set, calling takeCentralWidget should
just return a null pointer instead of crashing.
[ChangeLog][QtWidgets][QMainWindow] Fixed crash using takeCentralWidget when
the central widget was not set.
Task-number: QTBUG-56628
Change-Id: I240ccf4caa41d2716a78851571fbfbf444a4922e
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'tests/auto/widgets/widgets/qmainwindow')
-rw-r--r-- | tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index 6282028746..ece011d145 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -864,6 +864,10 @@ void tst_QMainWindow::takeCentralWidget() { QVERIFY(!mw.centralWidget()); + // verify that we don't crash when trying to take a non-set + // central widget but just return a null pointer instead + QVERIFY(!mw.takeCentralWidget()); + mw.setCentralWidget(w1); QWidget *oldCentralWidget = mw.takeCentralWidget(); |