fixed frame hierarchy bugs

This commit is contained in:
aap 2020-08-10 08:22:50 +02:00
parent d92996c66d
commit 0f0147272c
4 changed files with 5 additions and 2 deletions

View File

@ -345,6 +345,7 @@ Camera::destroy(void)
s_plglist.destruct(this); s_plglist.destruct(this);
assert(this->clump == nil); assert(this->clump == nil);
assert(this->world == nil); assert(this->world == nil);
this->setFrame(nil);
rwFree(this); rwFree(this);
numAllocated--; numAllocated--;
} }

View File

@ -58,7 +58,7 @@ Clump::clone(void)
atomic->setFrame(a->getFrame()->root); atomic->setFrame(a->getFrame()->root);
clump->addAtomic(atomic); clump->addAtomic(atomic);
} }
root->purgeClone(); this->getFrame()->purgeClone();
// World extension // World extension
if(this->world) if(this->world)

View File

@ -1,5 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <assert.h>
#include "rwbase.h" #include "rwbase.h"
#include "rwerror.h" #include "rwerror.h"
@ -51,7 +52,6 @@ Frame::cloneHierarchy(void)
this->purgeClone(); this->purgeClone();
return frame; return frame;
} }
void void
Frame::destroy(void) Frame::destroy(void)
{ {
@ -76,6 +76,7 @@ Frame::destroyHierarchy(void)
next = child->next; next = child->next;
child->destroyHierarchy(); child->destroyHierarchy();
} }
assert(this->objectList.isEmpty());
s_plglist.destruct(this); s_plglist.destruct(this);
if(this->object.privateFlags & Frame::HIERARCHYSYNC) if(this->object.privateFlags & Frame::HIERARCHYSYNC)
this->inDirtyList.remove(); this->inDirtyList.remove();

View File

@ -69,6 +69,7 @@ Light::destroy(void)
s_plglist.destruct(this); s_plglist.destruct(this);
assert(this->clump == nil); assert(this->clump == nil);
assert(this->world == nil); assert(this->world == nil);
this->setFrame(nil);
rwFree(this); rwFree(this);
numAllocated--; numAllocated--;
} }