summaryrefslogtreecommitdiffstats
path: root/src/core/nodes/qnode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/nodes/qnode.cpp')
-rw-r--r--src/core/nodes/qnode.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/nodes/qnode.cpp b/src/core/nodes/qnode.cpp
index ad084242f..7ae29f222 100644
--- a/src/core/nodes/qnode.cpp
+++ b/src/core/nodes/qnode.cpp
@@ -141,6 +141,11 @@ void QNodePrivate::notifyDestructionChangesAndRemoveFromScene()
{
Q_Q(QNode);
+ // Ensure this node is not queued up for post-construction init
+ // to avoid crashing when the event loop spins.
+ if (m_scene && m_scene->postConstructorInit())
+ m_scene->postConstructorInit()->removeNode(q);
+
// We notify the backend that the parent lost us as a child
if (m_changeArbiter != nullptr && !m_parentId.isNull()) {
const auto change = QPropertyNodeRemovedChangePtr::create(m_parentId, q);