ecore: Avoid double free with promises

This commit is contained in:
Jean-Philippe Andre 2017-12-15 19:09:02 +09:00
parent 796b1dd566
commit fed8123448
2 changed files with 13 additions and 4 deletions

View File

@ -1574,6 +1574,9 @@ _ecore_main_content_clear(Efl_Loop_Data *pd)
EINA_LIST_FREE(tmp, promise)
ecore_loop_promise_fulfill(promise);
// FIXME
__eina_promise_cancel_all();
while (pd->fd_handlers)
{
Ecore_Fd_Handler *fdh = pd->fd_handlers;

View File

@ -824,8 +824,11 @@ _efl_promise_all_free(Efl_Promise_All *all)
EINA_ARRAY_ITER_NEXT(&all->members, i, fa, iterator)
{
if (fa->d)
EINA_REFCOUNT_UNREF(fa->d)
_efl_promise_msg_free(fa->d);
{
EINA_REFCOUNT_UNREF(fa->d)
_efl_promise_msg_free(fa->d);
fa->d = NULL;
}
}
efl_del(all->promise);
all->promise = NULL;
@ -839,8 +842,11 @@ _efl_promise_all_die(void *data, const Efl_Event *ev EINA_UNUSED)
while ((fa = eina_array_pop(&all->members)))
{
EINA_REFCOUNT_UNREF(fa->d)
_efl_promise_msg_free(fa->d);
if (fa->d)
{
EINA_REFCOUNT_UNREF(fa->d)
_efl_promise_msg_free(fa->d);
}
assert(fa->f == NULL);
free(fa);
}