Move protected area by mutex 01/305301/4
authorjphnix <jphnix99@gmail.com>
Wed, 31 Jan 2024 05:46:09 +0000 (05:46 +0000)
committerJinbong Lee <jinbong.lee@samsung.com>
Wed, 31 Jan 2024 08:59:31 +0000 (08:59 +0000)
  - surface->post_interval is needed to be protected by mutex

Change-Id: I8f70ccb15e38fcfc24f2a4d326eeea6003eba9e8

src/tpl_wl_vk_thread.c

index a5b4bc0..9c96a3e 100644 (file)
@@ -1452,22 +1452,23 @@ static tpl_result_t
 __tpl_wl_vk_surface_set_post_interval(tpl_surface_t *surface,
                                                                                  int post_interval)
 {
-       tpl_wl_vk_surface_t *wl_vk_surface = NULL;
-
        TPL_CHECK_ON_NULL_RETURN_VAL(surface, TPL_ERROR_INVALID_PARAMETER);
 
-       wl_vk_surface = (tpl_wl_vk_surface_t *)surface->backend.data;
+       tpl_wl_vk_surface_t *wl_vk_surface = (tpl_wl_vk_surface_t *)surface->backend.data;
 
        TPL_CHECK_ON_NULL_RETURN_VAL(wl_vk_surface, TPL_ERROR_INVALID_PARAMETER);
 
+       tpl_gmutex_lock(&wl_vk_surface->surf_mutex);
+
        TPL_INFO("[SET_POST_INTERVAL]",
                         "wl_vk_surface(%p) post_interval(%d -> %d)",
                         wl_vk_surface, wl_vk_surface->post_interval, post_interval);
 
-       tpl_gmutex_lock(&wl_vk_surface->surf_mutex);
        wl_vk_surface->post_interval = post_interval;
        tpl_gmutex_unlock(&wl_vk_surface->surf_mutex);
 
+
+
        return TPL_ERROR_NONE;
 }