diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2016-09-26 09:16:21 +0900 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2016-09-26 09:16:21 +0900 |
commit | ccbf5371910874cadc438c42c405bafe0578db25 (patch) | |
tree | b5ef9d4cbafddc20b5c9efdc820fa70eb2a07dba | |
parent | 4f46757f5ff191979cbc68da4b20563f56b57690 (diff) | |
download | efl-ccbf5371910874cadc438c42c405bafe0578db25.tar.gz |
eo ptr indir - handle unlock on error with shared eoids correctly
this fixes the error handling for shared objects which would fail to
unlock on lookup error.
-rw-r--r-- | src/lib/eo/eo_ptr_indirection.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/lib/eo/eo_ptr_indirection.c b/src/lib/eo/eo_ptr_indirection.c index f7f7efa201..0f9b3df7f0 100644 --- a/src/lib/eo/eo_ptr_indirection.c +++ b/src/lib/eo/eo_ptr_indirection.c @@ -79,7 +79,7 @@ _eo_obj_pointer_get(const Eo_Id obj_id) domain = (obj_id >> SHIFT_DOMAIN) & MASK_DOMAIN; data = _eo_table_data_get(); tdata = _eo_table_data_table_get(data, domain); - if (!tdata) goto err_invalid; + if (!tdata) goto err; if (EINA_LIKELY(domain != EFL_ID_DOMAIN_SHARED)) @@ -93,7 +93,7 @@ _eo_obj_pointer_get(const Eo_Id obj_id) // get tag bit to check later down below - pipelining tag_bit = (obj_id) & MASK_OBJ_TAG; if (!obj_id) goto err_null; - else if (!tag_bit) goto err_invalid; + else if (!tag_bit) goto err; EO_DECOMPOSE_ID(obj_id, mid_table_id, table_id, entry_id, generation); @@ -128,8 +128,8 @@ _eo_obj_pointer_get(const Eo_Id obj_id) // get tag bit to check later down below - pipelining tag_bit = (obj_id) & MASK_OBJ_TAG; - if (!obj_id) goto err_null; - else if (!tag_bit) goto err_invalid; + if (!obj_id) goto err_shared_null; + else if (!tag_bit) goto err_shared; EO_DECOMPOSE_ID(obj_id, mid_table_id, table_id, entry_id, generation); @@ -151,16 +151,18 @@ _eo_obj_pointer_get(const Eo_Id obj_id) } } } - eina_spinlock_release(&(tdata->lock)); - goto err; + goto err_shared; shared_ok: eina_spinlock_release(&(tdata->lock)); return ptr; } +err_shared_null: + eina_spinlock_release(&(tdata->lock)); err_null: DBG("obj_id is NULL. Possibly unintended access?"); return NULL; -err_invalid: +err_shared: + eina_spinlock_release(&(tdata->lock)); err: _eo_obj_pointer_invalid(obj_id, data, domain); return NULL; |