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 39417cf0ea
This commit is contained in:
parent
9aee7c249a
commit
200f45c2b5
|
@ -537,8 +537,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 */
|
||||
|
|
Loading…
Reference in New Issue