summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2017-05-29 13:45:25 +0200
committerOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>2017-05-30 16:57:30 +0000
commitc70c1d54f437e77f1e75b3f438b4c3dd6f1ce5a0 (patch)
tree17e0a3341071f20d5759bc119867b3f249c027ab /src/widgets/kernel
parentc3030d7163245b55abfd09eefe696c035c55011c (diff)
QStackedLayout: Fix UB (invalid cast) in qt_wasDeleted()
Fixup of commit b4995eb7491c1b4784a1bf48db834c11c42b8d9d. We can't call QWidgetPrivate::get(w) on a deleted QWidget, because of the call to the member function QWidget::d_func. We can however call QObjectPrivate::get since we still are in the QObject destructor. tst_qstackedlayout now pass without ubsan Warnings. Change-Id: I4e839a97ddbd1cf21435a8fca76523b98a1f7d9b Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qstackedlayout.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp
index d9c1c524d7..b8b6f4302d 100644
--- a/src/widgets/kernel/qstackedlayout.cpp
+++ b/src/widgets/kernel/qstackedlayout.cpp
@@ -253,7 +253,7 @@ QLayoutItem *QStackedLayout::itemAt(int index) const
// on the object then)
static bool qt_wasDeleted(const QWidget *w)
{
- return QWidgetPrivate::get(w)->wasDeleted;
+ return QObjectPrivate::get(w)->wasDeleted;
}