aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/ephysics/src/lib
diff options
context:
space:
mode:
authorLeandro Dorileo <dorileo@profusion.mobi>2012-11-23 21:51:53 +0000
committerBruno Dilly <bdilly@profusion.mobi>2012-11-23 21:51:53 +0000
commitf4ce94ee1842950acc783e3fddcb4d07a2b29f0b (patch)
tree38a232291332f7810ba4281948e300bf07f357c7 /legacy/ephysics/src/lib
parentecd61b29afe35de33bf6430ac8277435c2713a10 (diff)
downloadefl-f4ce94ee1842950acc783e3fddcb4d07a2b29f0b.tar.gz
efl-f4ce94ee1842950acc783e3fddcb4d07a2b29f0b.tar.xz
efl-f4ce94ee1842950acc783e3fddcb4d07a2b29f0b.zip
EPhysics: avoid slices double deletion
This patch avoids slices double deletion case ecore evas deletes the slices evas objects before ephysics has actually shutdown and/or simulation thread hasn't been canceled. Patch by: Leandro Dorileo <dorileo@profusion.mobi> SVN revision: 79605
Diffstat (limited to 'legacy/ephysics/src/lib')
-rw-r--r--legacy/ephysics/src/lib/ephysics_body.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/legacy/ephysics/src/lib/ephysics_body.cpp b/legacy/ephysics/src/lib/ephysics_body.cpp
index 6119d4fa2..8ab396208 100644
--- a/legacy/ephysics/src/lib/ephysics_body.cpp
+++ b/legacy/ephysics/src/lib/ephysics_body.cpp
@@ -254,6 +254,15 @@ ephysics_body_soft_body_slice_index_get(EPhysics_Body *body, Evas_Object *slice)
}
static void
+_ephysics_body_soft_body_slice_del_cb(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+{
+ EPhysics_Body_Soft_Body_Slice *slice = (EPhysics_Body_Soft_Body_Slice *)data;
+ slice->evas_obj = NULL;
+ evas_object_event_callback_del(obj, EVAS_CALLBACK_DEL,
+ _ephysics_body_soft_body_slice_del_cb);
+}
+
+static void
_ephysics_body_soft_body_slices_init(EPhysics_Body *body, Evas_Object *obj, Eina_List *slices)
{
EPhysics_Body_Soft_Body_Slice *slice = NULL;
@@ -277,6 +286,9 @@ _ephysics_body_soft_body_slices_init(EPhysics_Body *body, Evas_Object *obj, Eina
evas_object_resize(slice->evas_obj, w, h);
evas_object_show(slice->evas_obj);
evas_object_image_smooth_scale_set(slice->evas_obj, EINA_TRUE);
+ evas_object_event_callback_add(slice->evas_obj, EVAS_CALLBACK_DEL,
+ _ephysics_body_soft_body_slice_del_cb,
+ slice);
}
if (slice)
@@ -294,7 +306,8 @@ _ephysics_body_soft_body_slices_free(Eina_List *slices)
EINA_LIST_FREE(slices, slice_data)
{
slice = (EPhysics_Body_Soft_Body_Slice *)slice_data;
- evas_object_del(slice->evas_obj);
+ if (slice->evas_obj)
+ evas_object_del(slice->evas_obj);
free(slice);
}
}
@@ -309,8 +322,8 @@ _ephysics_body_soft_body_slices_clean(Eina_List *slices)
EINA_LIST_FOREACH(slices, l, slice_data)
{
slice = (EPhysics_Body_Soft_Body_Slice *)slice_data;
- evas_object_del(slice->evas_obj);
- slice->evas_obj = NULL;
+ if (slice->evas_obj)
+ evas_object_del(slice->evas_obj);
}
}