ecore: properly cleanup callbacks of future/promise.
authorCedric BAIL <cedric@osg.samsung.com>
Tue, 11 Jul 2017 18:02:47 +0000 (11:02 -0700)
committerCedric BAIL <cedric@osg.samsung.com>
Tue, 11 Jul 2017 18:02:47 +0000 (11:02 -0700)
src/lib/ecore/efl_promise.c

index ac0d48d..f95e129 100644 (file)
@@ -99,7 +99,8 @@ _efl_loop_future_success(Efl_Event *ev, Efl_Loop_Future_Data *pd, void *value)
    chain_success.value = value;
 
    pd->propagating++;
-   EINA_INLIST_FREE(pd->callbacks, cb)
+   // This is done on purpose, we are using cb as a reminder to the head of the list
+   while ((cb = (void*) pd->callbacks))
      {
         // Remove callback early to avoid double execution while
         // doing recursive call
@@ -136,7 +137,8 @@ _efl_loop_future_failure(Efl_Event *ev, Efl_Loop_Future_Data *pd, Eina_Error err
    chain_fail.error = error;
 
    pd->propagating++;
-   EINA_INLIST_FREE(pd->callbacks, cb)
+   // This is done on purpose, we are using cb as a reminder to the head of the list
+   while ((cb = (void*) pd->callbacks))
      {
         // Remove callback early to avoid double execution while
         // doing recursive call