karim.salama Posted January 5, 2021 Share Posted January 5, 2021 Hello, I am currently using the Unigine C++ API version 2.6.1 and at some point I clone the root node of a reference by calling reference->getReference()->clone(); This node's children has NodeDummy children. When I remove all the cloned node's (direct) children, the dummies are still in the world but not managed by the editor. Here is how I remove them : for (int i = node->getNumChildren() - 1; i >= 0; i--) { auto child = node->getChild(i); node->removeChild(child); child->grab(); child.clear(); } This means that there's a memory leak. Because the "grandchildren" are not deleted/removed. Anyone has any idea how to solve this problem? Thanks in advance Link to comment
karim.salama Posted January 5, 2021 Author Share Posted January 5, 2021 I managed to solve this issue by recursively "grabbing" the node and it's children using the following function : void grabNodeRecursively(const Unigine::NodePtr& node) { node->grab(); for (int i = node->getNumChildren() - 1; i >= 0; i--) { grabNodeRecursively(node->getChild(i)); } } Thanks anyways Link to comment
silent Posted January 11, 2021 Share Posted January 11, 2021 Hi Karim, This is expected behavior for the old SDKs. In the newest versions you can simply replace grab() with deleteLater(). Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
karim.salama Posted January 11, 2021 Author Share Posted January 11, 2021 Hi @silent, Ok, good to know. Thanks Link to comment
Recommended Posts