Don't set the wasDeleted flag in ~QWidget
Setting it too early can cause issues, as we are still doing lots of work here as e.g. calling hide() on children. But the flag is required when we delete the declarative data, so set and reset it when destroying that data. Amends c579f49e2a80a55a4004ff8e5b2ee76bda146387 Task-number: QTBUG-68637 Change-Id: I7ed35828c26912aa6d703ba6025e46b7911353fa Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
689a071e84
commit
225dcf355a
@ -1579,6 +1579,7 @@ QGraphicsItem::~QGraphicsItem()
|
||||
QObjectPrivate *p = QObjectPrivate::get(o);
|
||||
p->wasDeleted = true;
|
||||
if (p->declarativeData) {
|
||||
p->wasDeleted = true; // needed, so that destroying the declarative data does the right thing
|
||||
if (static_cast<QAbstractDeclarativeDataImpl*>(p->declarativeData)->ownedByQml1) {
|
||||
if (QAbstractDeclarativeData::destroyed_qml1)
|
||||
QAbstractDeclarativeData::destroyed_qml1(p->declarativeData, o);
|
||||
@ -1587,6 +1588,7 @@ QGraphicsItem::~QGraphicsItem()
|
||||
QAbstractDeclarativeData::destroyed(p->declarativeData, o);
|
||||
}
|
||||
p->declarativeData = 0;
|
||||
p->wasDeleted = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1677,8 +1677,8 @@ QWidget::~QWidget()
|
||||
}
|
||||
}
|
||||
|
||||
d->wasDeleted = true;
|
||||
if (d->declarativeData) {
|
||||
d->wasDeleted = true; // needed, so that destroying the declarative data does the right thing
|
||||
if (static_cast<QAbstractDeclarativeDataImpl*>(d->declarativeData)->ownedByQml1) {
|
||||
if (QAbstractDeclarativeData::destroyed_qml1)
|
||||
QAbstractDeclarativeData::destroyed_qml1(d->declarativeData, this);
|
||||
@ -1687,6 +1687,7 @@ QWidget::~QWidget()
|
||||
QAbstractDeclarativeData::destroyed(d->declarativeData, this);
|
||||
}
|
||||
d->declarativeData = 0; // don't activate again in ~QObject
|
||||
d->wasDeleted = false;
|
||||
}
|
||||
|
||||
d->blockSig = blocked;
|
||||
|
Loading…
x
Reference in New Issue
Block a user