Fixed to unref tbm_surface even when enqueue failed. 88/234688/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Thu, 14 May 2020 10:07:14 +0000 (19:07 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Thu, 14 May 2020 10:07:14 +0000 (19:07 +0900)
Change-Id: I99a3e93833430a652cb653d8343a6dfd1a2d2342
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/tpl_wl_egl_thread.c

index f3a0fc9..5ca8691 100755 (executable)
@@ -598,16 +598,8 @@ __tpl_wl_egl_surface_enqueue_buffer(tpl_surface_t *surface,
 
        tsq_err = tbm_surface_queue_enqueue(wayland_egl_surface->tbm_queue,
                                                                                tbm_surface);
-       if (tsq_err == TBM_SURFACE_QUEUE_ERROR_NONE) {
-               /*
-                * If tbm_surface_queue has not been reset, tbm_surface_queue_enqueue
-                * will return ERROR_NONE. Otherwise, queue has been reset
-                * this tbm_surface may have only one ref_count. So we need to
-                * unreference this tbm_surface after getting ERROR_NONE result from
-                * tbm_surface_queue_enqueue in order to prevent destruction.
-                */
+       if (tsq_err != TBM_SURFACE_QUEUE_ERROR_NONE) {
                tbm_surface_internal_unref(tbm_surface);
-       } else {
                TPL_ERR("Failed to enqueue tbm_surface(%p). tsq_err=%d",
                                tbm_surface, tsq_err);
                TRACE_ASYNC_END((int)tbm_surface, "[DEQ]~[ENQ] BO_NAME:%d", bo_name);
@@ -615,6 +607,8 @@ __tpl_wl_egl_surface_enqueue_buffer(tpl_surface_t *surface,
                return TPL_ERROR_INVALID_OPERATION;
        }
 
+       tbm_surface_internal_unref(tbm_surface);
+
        TRACE_ASYNC_END((int)tbm_surface, "[DEQ]~[ENQ] BO_NAME:%d", bo_name);
        TPL_OBJECT_UNLOCK(wayland_egl_surface);