summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2016-10-17 15:14:47 -0200
committerBruno Dilly <bdilly@profusion.mobi>2016-10-17 15:14:47 -0200
commitf47833f6c5315df510ef7d2a34acd4697d568775 (patch)
tree804c0a1a44ed8ad2e258cd77159d7280ecaf6d99
parentf09dc5070564800e153aeefa1466d14006cfcd1e (diff)
Fix abortion on bodies deletionHEADmaster
Fix issues when deleting static bodies (when you change levels or presse menu option). It was leading to the following error: Aborting due to Chipmunk error: Cannot remove a body that was not added to the space. (Removed twice maybe?) Failed condition: cpSpaceContainsBody(space, body) Source:/build/buildd/chipmunk-6.1.5/src/cpSpace.c:403 Static bodies shouldn't be added to space on Chipmunk, and that's correct. But for some reason we're trying to remove them from space under certain circustances.
-rw-r--r--src/bin/physic_object.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bin/physic_object.c b/src/bin/physic_object.c
index 1f365e5..387768a 100644
--- a/src/bin/physic_object.c
+++ b/src/bin/physic_object.c
@@ -520,7 +520,10 @@ void physic_object_del(PhysicObject *pobj)
520 evas_object_del(obj); 520 evas_object_del(obj);
521 521
522 //remove body 522 //remove body
523 cpSpaceRemoveBody(space, pobj->body); 523 // But don't try to remove static bodies, since they're not
524 // added to space (otherwise they would be simulated).
525 if (!pobj->static_body)
526 cpSpaceRemoveBody(space, pobj->body);
524 cpBodyFree(pobj->body); 527 cpBodyFree(pobj->body);
525 528
526 physic_objects = eina_list_remove(physic_objects, pobj); 529 physic_objects = eina_list_remove(physic_objects, pobj);