Eo: Check adding/deleting callbacks from within callbacks doesn't crash.
authorTom Hacohen <tom@stosb.com>
Wed, 6 Jun 2012 11:41:51 +0000 (11:41 +0000)
committerTom Hacohen <tom@stosb.com>
Wed, 6 Jun 2012 11:41:51 +0000 (11:41 +0000)
SVN revision: 71745

legacy/eobj/examples/signals/main.c

index 0a32d0a..26ac853 100644 (file)
@@ -6,6 +6,16 @@
 static int cb_count = 0;
 
 static Eina_Bool
+_null_cb(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info)
+{
+   (void) desc;
+   (void) obj;
+   (void) data;
+   (void) event_info;
+   return EO_CALLBACK_CONTINUE;
+}
+
+static Eina_Bool
 _a_changed_cb(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info)
 {
    (void) desc;
@@ -15,6 +25,9 @@ _a_changed_cb(void *data, Eo *obj, const Eo_Event_Description *desc, void *event
 
    cb_count++;
 
+   eo_do(obj, eo_event_callback_priority_add(EV_A_CHANGED, EO_CALLBACK_PRIORITY_BEFORE, _null_cb, (void *) 23423));
+   eo_do(obj, eo_event_callback_del(EV_A_CHANGED, _null_cb, (void *) 23423));
+
    /* Stop as we reached the 3rd one. */
    return (cb_count != 3);
 }