diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2019-06-12 14:37:19 +0200 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2019-07-15 10:33:15 +0200 |
commit | c732dd6f6bb4d121a16f6ab53bbb571e9f7f5965 (patch) | |
tree | 8a063c1d37a42f5c9f79d1137fbf51ebef65af1a /src | |
parent | 650a169aa618dad762957337ba16f7fba22e5d05 (diff) |
Joints: remove removed joints from dirty list
In case a joint is added and destroyed within the same loop of the event loop,
we need to remove it from the list of dirty joints to process as this otherwise
results in an assert.
Change-Id: If2f4ece6e2d69a7801ce9c4ec2cb732f48895ad1
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/render/backend/managers.cpp | 6 | ||||
-rw-r--r-- | src/render/backend/managers_p.h | 1 | ||||
-rw-r--r-- | src/render/geometry/joint.cpp | 1 |
3 files changed, 8 insertions, 0 deletions
diff --git a/src/render/backend/managers.cpp b/src/render/backend/managers.cpp index 26fd68600..aa7dbb741 100644 --- a/src/render/backend/managers.cpp +++ b/src/render/backend/managers.cpp @@ -110,6 +110,12 @@ void JointManager::addDirtyJoint(Qt3DCore::QNodeId jointId) m_dirtyJoints.push_back(jointHandle); } +void JointManager::removeDirtyJoint(Qt3DCore::QNodeId jointId) +{ + const HJoint jointHandle = lookupHandle(jointId); + m_dirtyJoints.removeAll(jointHandle); +} + QVector<HJoint> JointManager::dirtyJoints() { return std::move(m_dirtyJoints); diff --git a/src/render/backend/managers_p.h b/src/render/backend/managers_p.h index b62e2f3e0..fc2a0b479 100644 --- a/src/render/backend/managers_p.h +++ b/src/render/backend/managers_p.h @@ -428,6 +428,7 @@ class JointManager : public Qt3DCore::QResourceManager< { public: void addDirtyJoint(Qt3DCore::QNodeId jointId); + void removeDirtyJoint(Qt3DCore::QNodeId jointId); QVector<HJoint> dirtyJoints(); private: diff --git a/src/render/geometry/joint.cpp b/src/render/geometry/joint.cpp index 9c53b8ef8..c770564f9 100644 --- a/src/render/geometry/joint.cpp +++ b/src/render/geometry/joint.cpp @@ -153,6 +153,7 @@ Qt3DCore::QBackendNode *JointFunctor::get(Qt3DCore::QNodeId id) const void JointFunctor::destroy(Qt3DCore::QNodeId id) const { + m_jointManager->removeDirtyJoint(id); m_jointManager->releaseResource(id); } |