Gesture Layer: fix crash during deletion.
authorAharon Hillel <a.hillel@samsung.com>
Mon, 1 Jul 2013 15:37:17 +0000 (18:37 +0300)
committerSungho Kwak <sungho1.kwak@samsung.com>
Mon, 8 Jul 2013 06:47:09 +0000 (15:47 +0900)
if target object is deleted before GLayer is deleted, we get a crash
from _event_history_clear.
Setting target to NULL on delete, then testing it before reporting state
takes care of this problem.

Change-Id: I48fe1a1effe3fc4ea6629b587f7f7d9bf1749620

src/lib/elm_gesture_layer.c

index 5e8db21..d6a1741 100644 (file)
@@ -958,6 +958,8 @@ _target_del_cb(void *data,
                void *event_info __UNUSED__)
 {
    _callbacks_unregister(data);
+   ELM_GESTURE_LAYER_DATA_GET(data, sd);
+   sd->target = NULL;
 }
 
 /**
@@ -1163,8 +1165,9 @@ _event_history_clear(Evas_Object *obj)
                }
              else
                {  /* Report ABORT to all gestures that still not finished */
-                 _state_set(p, ELM_GESTURE_STATE_ABORT, sd->gesture[i]->info,
-                            EINA_FALSE);
+                  if (sd->target)
+                    _state_set(p, ELM_GESTURE_STATE_ABORT,
+                          sd->gesture[i]->info, EINA_FALSE);
                }
           }
      }