Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.7.0
-
None
-
Windows
Description
I am getting the following assert when I delete an entity that have children :
ASSERT: "m_entries[index].m_counter == handle.counter()" in file c:/Users/qt/work/qt/qt3d/src/core/resources/qhandlemanager_p.h, line 170
It doesn't happens on the first delete but after few.
I can get it in our application by using undo/redo, because it delete the object and recreate it.
I was able to fix it by deleting all children of the root entity of object with the following code :
void releaseModel(Qt3DCore::QNode& model)
{
QEntity* entity = dynamic_cast<QEntity*>(&model);
if (entity)
{
QComponentVector components = entity->components();
foreach (QComponent* component, components)
{
entity->removeComponent(component);
delete component;
}
}
QNodeVector nodes = model.childNodes();
foreach (QNode* node, nodes)
{
releaseModel(*node);
delete node;
}
}