From 0f0147272cabf4225a123b20b2147783259b04fe Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 10 Aug 2020 08:22:50 +0200 Subject: [PATCH] fixed frame hierarchy bugs --- src/camera.cpp | 1 + src/clump.cpp | 2 +- src/frame.cpp | 3 ++- src/light.cpp | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/camera.cpp b/src/camera.cpp index e0e38c5..4a87ed3 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -345,6 +345,7 @@ Camera::destroy(void) s_plglist.destruct(this); assert(this->clump == nil); assert(this->world == nil); + this->setFrame(nil); rwFree(this); numAllocated--; } diff --git a/src/clump.cpp b/src/clump.cpp index 5da5be7..f228298 100644 --- a/src/clump.cpp +++ b/src/clump.cpp @@ -58,7 +58,7 @@ Clump::clone(void) atomic->setFrame(a->getFrame()->root); clump->addAtomic(atomic); } - root->purgeClone(); + this->getFrame()->purgeClone(); // World extension if(this->world) diff --git a/src/frame.cpp b/src/frame.cpp index 2edd139..c8dabd5 100644 --- a/src/frame.cpp +++ b/src/frame.cpp @@ -1,5 +1,6 @@ #include #include +#include #include "rwbase.h" #include "rwerror.h" @@ -51,7 +52,6 @@ Frame::cloneHierarchy(void) this->purgeClone(); return frame; } - void Frame::destroy(void) { @@ -76,6 +76,7 @@ Frame::destroyHierarchy(void) next = child->next; child->destroyHierarchy(); } + assert(this->objectList.isEmpty()); s_plglist.destruct(this); if(this->object.privateFlags & Frame::HIERARCHYSYNC) this->inDirtyList.remove(); diff --git a/src/light.cpp b/src/light.cpp index 20e2881..ca68cda 100644 --- a/src/light.cpp +++ b/src/light.cpp @@ -69,6 +69,7 @@ Light::destroy(void) s_plglist.destruct(this); assert(this->clump == nil); assert(this->world == nil); + this->setFrame(nil); rwFree(this); numAllocated--; }