From: SooChan Lim Date: Wed, 14 Aug 2013 02:05:03 +0000 (+0900) Subject: lock before map and unlock after unmap X-Git-Tag: accepted/tizen/generic/20140415.103911^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ae239898e9e011b8893c739e850c3ba3f1b76815;p=platform%2Fcore%2Fuifw%2Flibtbm.git lock before map and unlock after unmap Change-Id: If81c5083f345d6bdeac0d9d33cd2e861ab885318 --- diff --git a/packaging/libtbm.spec b/packaging/libtbm.spec index 0c8dbc6..7567a07 100644 --- a/packaging/libtbm.spec +++ b/packaging/libtbm.spec @@ -1,6 +1,6 @@ Name: libtbm Version: 1.0.6 -Release: 4 +Release: 5 License: MIT Summary: Tizen Buffer Manager Library Group: System/Libraries diff --git a/src/tbm_bufmgr.c b/src/tbm_bufmgr.c index 417ef11..3e7c3b8 100755 --- a/src/tbm_bufmgr.c +++ b/src/tbm_bufmgr.c @@ -1193,10 +1193,12 @@ tbm_bo_map (tbm_bo bo, int device, int opt) pthread_mutex_lock (&bufmgr->lock); - bo_handle = bufmgr->backend->bo_map (bo, device, opt); + bo_handle = bufmgr->backend->bo_get_handle (bo, device); _tbm_bo_lock (bo, device, opt); + bo_handle = bufmgr->backend->bo_map (bo, device, opt); + if (bufmgr->use_map_cache == 1 && bo->map_cnt == 0) _tbm_bo_set_state (bo, device, opt); @@ -1220,7 +1222,6 @@ tbm_bo_unmap (tbm_bo bo) pthread_mutex_lock (&bufmgr->lock); - _tbm_bo_unlock (bo); ret = bufmgr->backend->bo_unmap (bo); @@ -1230,6 +1231,8 @@ tbm_bo_unmap (tbm_bo bo) if (bo->map_cnt == 0) _tbm_bo_save_state (bo); + _tbm_bo_unlock (bo); + pthread_mutex_unlock (&bufmgr->lock); return ret;