summaryrefslogtreecommitdiff
path: root/legacy/ephysics/src/lib/ephysics_body.cpp
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/ephysics_body.cpp
parentecd61b29afe35de33bf6430ac8277435c2713a10 (diff)
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 '')
-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 6119d4fa25..8ab3962083 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)
254} 254}
255 255
256static void 256static void
257_ephysics_body_soft_body_slice_del_cb(void *data, Evas *evas __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
258{
259 EPhysics_Body_Soft_Body_Slice *slice = (EPhysics_Body_Soft_Body_Slice *)data;
260 slice->evas_obj = NULL;
261 evas_object_event_callback_del(obj, EVAS_CALLBACK_DEL,
262 _ephysics_body_soft_body_slice_del_cb);
263}
264
265static void
257_ephysics_body_soft_body_slices_init(EPhysics_Body *body, Evas_Object *obj, Eina_List *slices) 266_ephysics_body_soft_body_slices_init(EPhysics_Body *body, Evas_Object *obj, Eina_List *slices)
258{ 267{
259 EPhysics_Body_Soft_Body_Slice *slice = NULL; 268 EPhysics_Body_Soft_Body_Slice *slice = NULL;
@@ -277,6 +286,9 @@ _ephysics_body_soft_body_slices_init(EPhysics_Body *body, Evas_Object *obj, Eina
277 evas_object_resize(slice->evas_obj, w, h); 286 evas_object_resize(slice->evas_obj, w, h);
278 evas_object_show(slice->evas_obj); 287 evas_object_show(slice->evas_obj);
279 evas_object_image_smooth_scale_set(slice->evas_obj, EINA_TRUE); 288 evas_object_image_smooth_scale_set(slice->evas_obj, EINA_TRUE);
289 evas_object_event_callback_add(slice->evas_obj, EVAS_CALLBACK_DEL,
290 _ephysics_body_soft_body_slice_del_cb,
291 slice);
280 } 292 }
281 293
282 if (slice) 294 if (slice)
@@ -294,7 +306,8 @@ _ephysics_body_soft_body_slices_free(Eina_List *slices)
294 EINA_LIST_FREE(slices, slice_data) 306 EINA_LIST_FREE(slices, slice_data)
295 { 307 {
296 slice = (EPhysics_Body_Soft_Body_Slice *)slice_data; 308 slice = (EPhysics_Body_Soft_Body_Slice *)slice_data;
297 evas_object_del(slice->evas_obj); 309 if (slice->evas_obj)
310 evas_object_del(slice->evas_obj);
298 free(slice); 311 free(slice);
299 } 312 }
300} 313}
@@ -309,8 +322,8 @@ _ephysics_body_soft_body_slices_clean(Eina_List *slices)
309 EINA_LIST_FOREACH(slices, l, slice_data) 322 EINA_LIST_FOREACH(slices, l, slice_data)
310 { 323 {
311 slice = (EPhysics_Body_Soft_Body_Slice *)slice_data; 324 slice = (EPhysics_Body_Soft_Body_Slice *)slice_data;
312 evas_object_del(slice->evas_obj); 325 if (slice->evas_obj)
313 slice->evas_obj = NULL; 326 evas_object_del(slice->evas_obj);
314 } 327 }
315} 328}
316 329