jpeg pushed a commit to branch master. http://git.enlightenment.org/core/elementary.git/commit/?id=3153061c12079d42689ba6120786601cd7fe0d0d
commit 3153061c12079d42689ba6120786601cd7fe0d0d Author: Jean-Philippe Andre <[email protected]> Date: Wed Dec 16 20:21:34 2015 +0900 image: Lock access to thread variables Fixes CID 1343345 "Data race condition" --- src/lib/elm_image.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/elm_image.c b/src/lib/elm_image.c index f76eb9a..27adeda 100644 --- a/src/lib/elm_image.c +++ b/src/lib/elm_image.c @@ -333,16 +333,20 @@ _elm_image_async_open_done(void *data, Ecore_Thread *thread EINA_UNUSED) ELM_IMAGE_DATA_GET(obj, sd); - // no need to lock here, thread can't be running now + // async open thread can't be running now + // locking anyways to be sure (memory barrier), see CID 1343345 + eina_spinlock_take(&sd->async.lck); sd->async.th = NULL; sd->async_failed = EINA_FALSE; if (sd->async.todo) { + eina_spinlock_release(&sd->async.lck); sd->async.th = ecore_thread_run(_elm_image_async_open_do, _elm_image_async_open_done, _elm_image_async_open_cancel, obj); + return; } @@ -354,12 +358,14 @@ _elm_image_async_open_done(void *data, Ecore_Thread *thread EINA_UNUSED) // done should be NULL only after cancel... not here ERR("Async open failed for an unknown reason."); sd->async_failed = EINA_TRUE; + eina_spinlock_release(&sd->async.lck); eo_do(obj, eo_event_callback_call(EFL_FILE_EVENT_ASYNC_ERROR, NULL)); return; } DBG("Async open succeeded"); sd->async.done = NULL; + eina_spinlock_release(&sd->async.lck); key = done->key; map = done->map; f = done->f_open; --
