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.
This commit is contained in:
Larry Jr 2016-06-02 13:59:23 -03:00 committed by Felipe Magno de Almeida
parent 7e0601c980
commit 507bbdb054
1 changed files with 1 additions and 1 deletions

View File

@ -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;