summaryrefslogtreecommitdiffstats
path: root/src/core/nodes/qcomponent.cpp
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@kdab.com>2015-01-22 16:36:54 +0100
committerSean Harmer <sean.harmer@kdab.com>2015-01-28 11:47:02 +0000
commit1b9308fe6bf2a0bc0e6f9b807732d95bbca50e7d (patch)
treeaa5f216e213f80e9c338c27703ad915d66f72a05 /src/core/nodes/qcomponent.cpp
parent474ad03e4977116c12e7cd87c26295c8590b1f60 (diff)
Cleanup entities component lists on destruction
Change-Id: I1e5f006b612a69e6b5cc98aecb6c8fdc3d6281b0 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/core/nodes/qcomponent.cpp')
-rw-r--r--src/core/nodes/qcomponent.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/nodes/qcomponent.cpp b/src/core/nodes/qcomponent.cpp
index 37e7aaaeb..5f698e70a 100644
--- a/src/core/nodes/qcomponent.cpp
+++ b/src/core/nodes/qcomponent.cpp
@@ -42,6 +42,7 @@
#include "qcomponent.h"
#include "qcomponent_p.h"
#include "qentity.h"
+#include "qentity_p.h"
#include <Qt3DCore/qscenepropertychange.h>
@@ -96,6 +97,11 @@ QComponent::QComponent(QNode *parent)
QComponent::~QComponent()
{
+ Q_FOREACH (QEntity *entity, entities()) {
+ QEntityPrivate *entityPimpl = dynamic_cast<QEntityPrivate *>(QEntityPrivate::get(entity));
+ if (entityPimpl)
+ entityPimpl->m_components.removeAll(this);
+ }
}
/*!