Fix QML integration of widgets
We need to mark the object as deleted before destroying it's declarative data, otherwise all sorts of bad things can happen. This fixes the qwidgetsinqml autotest in qtdeclarative. Change-Id: I05a645ebe1ca7a50c8927e3dbd9ebb5aaf369a71 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
a91b91ae57
commit
3e91625b58
@ -1677,6 +1677,7 @@ QWidget::~QWidget()
|
||||
}
|
||||
}
|
||||
|
||||
d->wasDeleted = true;
|
||||
if (d->declarativeData) {
|
||||
if (static_cast<QAbstractDeclarativeDataImpl*>(d->declarativeData)->ownedByQml1) {
|
||||
if (QAbstractDeclarativeData::destroyed_qml1)
|
||||
@ -8451,7 +8452,7 @@ bool QWidgetPrivate::close_helper(CloseMode mode)
|
||||
data.is_closing = 1;
|
||||
|
||||
QPointer<QWidget> that = q;
|
||||
QPointer<QWidget> parentWidget = q->parentWidget();
|
||||
QPointer<QWidget> parentWidget = (q->parentWidget() && !QObjectPrivate::get(q->parentWidget())->wasDeleted) ? q->parentWidget() : nullptr;
|
||||
|
||||
bool quitOnClose = q->testAttribute(Qt::WA_QuitOnClose);
|
||||
if (mode != CloseNoEvent) {
|
||||
|
Loading…
Reference in New Issue
Block a user