discomfitor pushed a commit to branch efl-1.16.

http://git.enlightenment.org/core/efl.git/commit/?id=cf03c8e44d0f72806108b2f5fc1c71be9b3c520b

commit cf03c8e44d0f72806108b2f5fc1c71be9b3c520b
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Mon Jan 25 11:24:54 2016 -0500

    efreet: add locking for efreet_desktop_x_field_get()
    
    in a threaded environment, reading from a hash is not atomic and is
    subject to race conditions
    
    @fix
    
    ref 39417cf0ea4e457fbc8d50d120bb8ac776aa366f
---
 src/lib/efreet/efreet_desktop.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/lib/efreet/efreet_desktop.c b/src/lib/efreet/efreet_desktop.c
index 0846d4b..2874610 100644
--- a/src/lib/efreet/efreet_desktop.c
+++ b/src/lib/efreet/efreet_desktop.c
@@ -531,8 +531,10 @@ efreet_desktop_x_field_get(Efreet_Desktop *desktop, const 
char *key)
     EINA_SAFETY_ON_NULL_RETURN_VAL(desktop->x, NULL);
     EINA_SAFETY_ON_TRUE_RETURN_VAL(strncmp(key, "X-", 2), NULL);
 
+    eina_lock_take(&_lock);
     ret = eina_hash_find(desktop->x, key);
     ret = eina_stringshare_add(ret);
+    eina_lock_release(&_lock);
     if (ret && (!ret[0]))
       {
          /* invalid null key somehow accepted; remove */

-- 


Reply via email to