edje: Reduce potential reentrant issue when using edje_object_signal_emit.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 28 Jul 2012 16:33:37 +0000 (16:33 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 28 Jul 2012 16:33:37 +0000 (16:33 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@74539 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
NEWS
src/lib/edje_match.c

index 78fee46..f015eef 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
         * Fix edje entry to extend selection to char pos/word or line
         when holding shift + mouse click.
 
+2012-07-29  Cedric Bail
+
+       * Reduce potential reentrant issue when using edje_object_signal_emit.
diff --git a/NEWS b/NEWS
index 0073072..ecda60a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,7 @@ Fixes:
     * Clamp image tween to never underflow also.
     * [entry] display preedit string even though there is no attribute
     * Fix shutdown of Edje_Multisense.
+    * Reduce potential reentrant issue when using edje_object_signal_emit.
 
 Edje 1.2.0
 
index f113f7b..375634e 100644 (file)
@@ -449,7 +449,7 @@ edje_match_programs_exec_check_finals(const size_t      *signal_finals,
 }
 
 static int
-edje_match_callback_exec_check_finals(const Edje_Patterns *singal_ppat,
+edje_match_callback_exec_check_finals(const Edje_Patterns *signal_ppat,
                                       const Edje_Patterns *source_ppat,
                                       const size_t      *signal_finals,
                                       const size_t      *source_finals,
@@ -462,10 +462,14 @@ edje_match_callback_exec_check_finals(const Edje_Patterns *singal_ppat,
                                       Eina_Bool          prop
                                      )
 {
+   Edje_Signal_Callback *escb;
+   Eina_Array   run;
    size_t       i;
    size_t       j;
    int          r = 1;
 
+   eina_array_step_set(&run, sizeof (Eina_Array), 4);
+
    for (i = 0; i < signal_states->size; ++i)
      {
         if (signal_states->states[i].pos >= signal_finals[signal_states->states[i].idx])
@@ -475,8 +479,6 @@ edje_match_callback_exec_check_finals(const Edje_Patterns *singal_ppat,
                   if (signal_states->states[i].idx == source_states->states[j].idx
                       && source_states->states[j].pos >= source_finals[source_states->states[j].idx])
                     {
-                       Edje_Signal_Callback      *escb;
-
                        escb = eina_list_nth(callbacks, signal_states->states[i].idx);
                        if (escb)
                          {
@@ -484,19 +486,25 @@ edje_match_callback_exec_check_finals(const Edje_Patterns *singal_ppat,
                             if ((!escb->just_added)
                                 && (!escb->delete_me))
                               {
-                                 escb->func(escb->data, ed->obj, sig, source);
+                                 eina_array_push(&run, escb);
                                  r = 2;
                               }
-                            if (_edje_block_break(ed))
-                               return 0;
-                            if ((singal_ppat->delete_me) || (source_ppat->delete_me))
-                               return 0;
                          }
                     }
                }
           }
      }
 
+   while ((escb = eina_array_pop(&run)))
+     {
+        escb->func(escb->data, ed->obj, sig, source);
+        if (_edje_block_break(ed))
+          return 0;
+        if ((signal_ppat->delete_me) || (source_ppat->delete_me))
+          return 0;
+     }
+   eina_array_flush(&run);
+
    return r;
 }