jketreno wrote:

....

I changed my code to create a new set of bounding elements, and delete the old ones after the new ones are added to the ClutterBox2D actor. However, in this case, clutter-box2d wasn't actually removing the Box2D body from the world when the actor contained in the ClutterBox2D was removed.

The attached patch attempts to fix that behavior by calling DestroyBody in clutter_box2d_destroy_child_meta.

Below is an updated patch from what I sent before.  Now it
checks for NULL before referencing...

It wasn't clear if the order of destruction in the world before/after removal from the hash table was relevant.

James

--- clutter-box2d/clutter-box2d.cpp     (revision 3257)
+++ clutter-box2d/clutter-box2d.cpp     (working copy)
@@ -276,6 +276,8 @@
  if (manipulatable)
    g_object_set (box2d_actor, "manipulatable", FALSE, NULL);

+  if (box2d_actor->body)
+    box2d_actor->world->DestroyBody (box2d_actor->body);

  g_hash_table_remove (CLUTTER_BOX2D (box2d)->actors, actor);
  g_hash_table_remove (CLUTTER_BOX2D (box2d)->bodies, box2d_actor->body);
--
To unsubscribe send a mail to [EMAIL PROTECTED]

Reply via email to