summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-12-15 19:09:02 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-18 19:54:31 +0900
commitfed81234480b7ed5b4d414f2df18b49992809a35 (patch)
tree73823c39b4eb3b2bf04f19408ec2061e01b547d1 /src/lib
parent796b1dd56684e5acf606c1f6f37edd61c9c47dbf (diff)
ecore: Avoid double free with promises
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ecore/ecore_main.c3
-rw-r--r--src/lib/ecore/efl_promise.c14
2 files changed, 13 insertions, 4 deletions
diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c
index 3ef5a7a5e0..ab90919e5d 100644
--- a/src/lib/ecore/ecore_main.c
+++ b/src/lib/ecore/ecore_main.c
@@ -1574,6 +1574,9 @@ _ecore_main_content_clear(Efl_Loop_Data *pd)
1574 EINA_LIST_FREE(tmp, promise) 1574 EINA_LIST_FREE(tmp, promise)
1575 ecore_loop_promise_fulfill(promise); 1575 ecore_loop_promise_fulfill(promise);
1576 1576
1577 // FIXME
1578 __eina_promise_cancel_all();
1579
1577 while (pd->fd_handlers) 1580 while (pd->fd_handlers)
1578 { 1581 {
1579 Ecore_Fd_Handler *fdh = pd->fd_handlers; 1582 Ecore_Fd_Handler *fdh = pd->fd_handlers;
diff --git a/src/lib/ecore/efl_promise.c b/src/lib/ecore/efl_promise.c
index 17e95489c6..3e522b4564 100644
--- a/src/lib/ecore/efl_promise.c
+++ b/src/lib/ecore/efl_promise.c
@@ -824,8 +824,11 @@ _efl_promise_all_free(Efl_Promise_All *all)
824 EINA_ARRAY_ITER_NEXT(&all->members, i, fa, iterator) 824 EINA_ARRAY_ITER_NEXT(&all->members, i, fa, iterator)
825 { 825 {
826 if (fa->d) 826 if (fa->d)
827 EINA_REFCOUNT_UNREF(fa->d) 827 {
828 _efl_promise_msg_free(fa->d); 828 EINA_REFCOUNT_UNREF(fa->d)
829 _efl_promise_msg_free(fa->d);
830 fa->d = NULL;
831 }
829 } 832 }
830 efl_del(all->promise); 833 efl_del(all->promise);
831 all->promise = NULL; 834 all->promise = NULL;
@@ -839,8 +842,11 @@ _efl_promise_all_die(void *data, const Efl_Event *ev EINA_UNUSED)
839 842
840 while ((fa = eina_array_pop(&all->members))) 843 while ((fa = eina_array_pop(&all->members)))
841 { 844 {
842 EINA_REFCOUNT_UNREF(fa->d) 845 if (fa->d)
843 _efl_promise_msg_free(fa->d); 846 {
847 EINA_REFCOUNT_UNREF(fa->d)
848 _efl_promise_msg_free(fa->d);
849 }
844 assert(fa->f == NULL); 850 assert(fa->f == NULL);
845 free(fa); 851 free(fa);
846 } 852 }