felipealmeida pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=507bbdb054044640f5c8cbcdd6ff6751e275d1da

commit 507bbdb054044640f5c8cbcdd6ff6751e275d1da
Author: Larry Jr <larry....@gmail.com>
Date:   Thu Jun 2 13:59:23 2016 -0300

    Eina: Fix eina_promise_all refcount ordering problem
    
    The call to eina_promise_then steals the first ref'count, so it is
    possible that the promise is freed after the eina_promise_then,
    so we need to eina_promise_ref before eina_promise_then.
---
 src/lib/eina/eina_promise.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/eina/eina_promise.c b/src/lib/eina/eina_promise.c
index a39e52e..2c5a14a 100644
--- a/src/lib/eina/eina_promise.c
+++ b/src/lib/eina/eina_promise.c
@@ -614,9 +614,9 @@ eina_promise_all(Eina_Iterator* it)
    last = internal_it->data.promises + internal_it->data.num_promises;
    for (;cur_promise != last; ++cur_promise)
      {
+        eina_promise_ref(*cur_promise); // We need to keep the value alive 
until this promise is freed
         eina_promise_then(*cur_promise, 
(Eina_Promise_Cb)&_eina_promise_all_compose_then_cb,
                           
(Eina_Promise_Error_Cb)&_eina_promise_all_compose_error_then_cb, promise);
-        eina_promise_ref(*cur_promise); // We need to keep the value alive 
until this promise is freed
      }
 
    return &promise->promise.vtable;

-- 


Reply via email to