forked from enlightenment/efl
elementary: prevent double free
This one is a bit tricky... When we create the aggregated promise, if one of the properties of the model returns an error, the eina_promise_then() will immediately call the error callback. In this happened for the first item, the total items in the listing request would be 1. Before this commit, we tested for incremented the processed counter and compared it to this total count. If it was greater or equal, we would free the common listing request. But in the case of successive failures, we would set the total counter to 1, then the processed counter to 1 and therefore free. Then increment the total counter to 2, then then processed counter to 2, and free again... which would cause an abort() from the libc or something else nasty. Now we just decrease the total count of items. We avoid the cases and double frees, without leaking.
This commit is contained in:
parent
322adb2e03
commit
0874c4da38
|
@ -774,17 +774,7 @@ _process_child_error_cb(void *data, Eina_Error err EINA_UNUSED)
|
|||
|
||||
WRN("could not get data from child Efl.Model");
|
||||
|
||||
++(lreq->item_processed_count);
|
||||
if (lreq->item_processed_count >= lreq->item_total)
|
||||
{
|
||||
if (!lreq->valid)
|
||||
{
|
||||
_listing_request_cleanup(lreq);
|
||||
return;
|
||||
}
|
||||
_signal_first(lreq);
|
||||
_process_last(lreq);
|
||||
}
|
||||
lreq->item_total--;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue