summaryrefslogtreecommitdiffstats
path: root/src/corelib
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/corelib
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/corelib')
-rw-r--r--src/corelib/kernel/qobject_p.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h
index a7d7ef0889..7b9253ac64 100644
--- a/src/corelib/kernel/qobject_p.h
+++ b/src/corelib/kernel/qobject_p.h
@@ -198,6 +198,7 @@ public:
static QObjectPrivate *get(QObject *o) {
return o->d_func();
}
+ static const QObjectPrivate *get(const QObject *o) { return o->d_func(); }
int signalIndex(const char *signalName, const QMetaObject **meta = 0) const;
inline bool isSignalConnected(uint signalIdx, bool checkDeclarative = true) const;