summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-06-05 14:40:36 +0200
committerJani Heikkinen <jani.heikkinen@qt.io>2018-06-07 09:41:24 +0000
commit225dcf355a95f272aaa7ac236c7274e254dca41c (patch)
tree5b3b001f11ac1ab2b935655e7e0e9a62b661f722
parent689a071e843dfbac49901018ba3c49b08e22fd94 (diff)
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>
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp2
-rw-r--r--src/widgets/kernel/qwidget.cpp3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index cef1d1b6da..fdf21fb499 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -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;
}
}
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 41f9d69c12..5f1f6d880a 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -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;