forked from enlightenment/efl
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:
parent
7e0601c980
commit
507bbdb054
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue