QStackedLayout: Fix UB (invalid cast) in qt_wasDeleted()
Fixup of commit b4995eb749
.
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>
This commit is contained in:
parent
c3030d7163
commit
c70c1d54f4
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user