summaryrefslogtreecommitdiff
path: root/src/lib/eina/eina_promise.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-05-31 14:18:48 -0700
committerCedric BAIL <cedric@osg.samsung.com>2016-05-31 14:59:26 -0700
commit9bcad265a72c29506644b9740efa0bdd1dc453a2 (patch)
tree63bdb4967fbc8569f47763a4f8999e40739d4d63 /src/lib/eina/eina_promise.c
parentbc0547a7056b60971fe875816c15068ed69d18a6 (diff)
eina: don't access dead promise.
We do properly unref promise while calling all the then callback. There is no need to check it a second time (which actually lead to a 100% bad access). T3759
Diffstat (limited to '')
-rw-r--r--src/lib/eina/eina_promise.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/lib/eina/eina_promise.c b/src/lib/eina/eina_promise.c
index 2b3f154f7d..a39e52e316 100644
--- a/src/lib/eina/eina_promise.c
+++ b/src/lib/eina/eina_promise.c
@@ -167,14 +167,14 @@ _eina_promise_then_calls(_Eina_Promise_Default_Owner* promise)
167 { 167 {
168 promise->promise.then_callbacks = eina_inlist_remove(promise->promise.then_callbacks, EINA_INLIST_GET(callback)); 168 promise->promise.then_callbacks = eina_inlist_remove(promise->promise.then_callbacks, EINA_INLIST_GET(callback));
169 if (error) 169 if (error)
170 { 170 {
171 if (callback->error_cb) 171 if (callback->error_cb)
172 (*callback->error_cb)(callback->data, promise->promise.error, &promise->promise.vtable); 172 (*callback->error_cb)(callback->data, promise->promise.error, &promise->promise.vtable);
173 } 173 }
174 else if (callback->callback) 174 else if (callback->callback)
175 { 175 {
176 (*callback->callback)(callback->data, &promise->value[0], &promise->promise.vtable); 176 (*callback->callback)(callback->data, &promise->value[0], &promise->promise.vtable);
177 } 177 }
178 free(callback); 178 free(callback);
179 _eina_promise_unref(&promise->promise); 179 _eina_promise_unref(&promise->promise);
180 } 180 }
@@ -327,10 +327,6 @@ _eina_promise_finish(_Eina_Promise_Default_Owner* promise)
327 { 327 {
328 _eina_promise_then_calls(promise); 328 _eina_promise_then_calls(promise);
329 } 329 }
330 if(promise->promise.ref == 0)
331 {
332 _eina_promise_del(promise);
333 }
334} 330}
335 331
336static Eina_Error 332static Eina_Error