From 65179870a950c07b0e28d7a0faa9ddc979685c1c Mon Sep 17 00:00:00 2001 From: fgenesis Date: Thu, 12 May 2016 00:25:00 +0200 Subject: [PATCH] Fix possible crash when loading applying a skeletal twice in one frame. Possibly a regression from 300f3267776. --- BBGE/RenderObject.cpp | 4 ++++ BBGE/SkeletalSprite.cpp | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/BBGE/RenderObject.cpp b/BBGE/RenderObject.cpp index 79960c1..7361adc 100644 --- a/BBGE/RenderObject.cpp +++ b/BBGE/RenderObject.cpp @@ -967,6 +967,10 @@ void RenderObject::enqueueChildDeletion(RenderObject *r) { if (r->parent == this) { + // Don't garbage a child more than once + for (size_t i = 0; i < childGarbage.size(); ++i) + if(childGarbage[i] == r) + return; childGarbage.push_back(r); } } diff --git a/BBGE/SkeletalSprite.cpp b/BBGE/SkeletalSprite.cpp index ce39dcb..d878678 100644 --- a/BBGE/SkeletalSprite.cpp +++ b/BBGE/SkeletalSprite.cpp @@ -1105,7 +1105,6 @@ void SkeletalSprite::deleteBones() { (*it)->safeKill(); } - bones.clear(); } Animation *SkeletalSprite::getAnimation(const std::string& anim)