Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to properly delete Entity loaded by EntityLoader?



  • Hello everyone!
    Faced the following problem. I load dynamically an Entity from external QML file using EntityLoader but sometimes it crashes with following error

    `ASSERT: "!node->parentEntity() || (!parentHandle.isNull() && m_nodeManagers->renderNodesManager()->data(parentHandle))" in file E:\Qt\Qt5\qt5.15.2\qt3d\src\render\backend\entity.cpp, line 207"

    It definetly has to do something with wrong fontend/backend synchromization.
    I've tryed:

    • setting parent to null before loading new entity
    • setting enabled property to false (before loading new entity)
    • explicitly calling 'destroy()': causes error 'Invalid attempt to destroy() an indestructible object'
    • something else (don't remember what)

    Is there any correct way to remove Entity without crashing the backend?
    Any help appreciated!


  • Moderators

    @VictorT said in How to properly delete Entity loaded by EntityLoader?:

    Faced the following problem. I load dynamically an Entity from external QML file using EntityLoader but sometimes it crashes with following error

    Please supply a minimal code snippet.

    setting parent to null before loading new entity

    The parent of what?

    explicitly calling 'destroy()': causes error 'Invalid attempt to destroy() an indestructible object'

    Where does this come from?

    Is there any correct way to remove Entity without crashing the backend?

    Simply deleting the object with deleteLater, however I have this feeling that's not where the problem is. The enitity loader is where the ownership is typically, so just switching the source should be enough.


Log in to reply