From c44d178766b614ca6eee60331531f64f82e7e47a Mon Sep 17 00:00:00 2001 From: devZoGok Date: Sun, 8 Mar 2020 13:06:08 +0200 Subject: [PATCH] nodes are dettached from parent befdre deletion --- node.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/node.cpp b/node.cpp index fd7b626..8f27ced 100755 --- a/node.cpp +++ b/node.cpp @@ -25,8 +25,12 @@ namespace vb01{ delete p; for(Text *t : texts) delete t; - for(Node *c : children) + for(Node *c : children){ + Node *par=c->getParent(); + if(par) + par->dettachChild(c); delete c; + } } void Node::update(){ @@ -35,12 +39,12 @@ namespace vb01{ l->update(); for(Mesh *m : meshes) m->update(); - for(ParticleEmitter *p : emitters) - p->update(); for(Text *t : texts) t->update(); for(Node *c : children) c->update(); + for(ParticleEmitter *p : emitters) + p->update(); } }