From: jinbong.lee Date: Wed, 13 Nov 2024 09:37:01 +0000 (+0900) Subject: Revert "Remove potential crash issue" X-Git-Tag: accepted/tizen/unified/20241114.092406^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=850e14edc99df95f19ca23ca118cd41ff6c8f68a;p=platform%2Fcore%2Fuifw%2Flibtpl-egl.git Revert "Remove potential crash issue" This reverts commit 3b965dde8e830c15009633b97b5ae81b10f1e422. Change-Id: I34b5e05bf060b7dacebb6ecdf4c45724d52f40f9 Signed-off-by: jinbong.lee --- diff --git a/src/tpl_wayland_egl.c b/src/tpl_wayland_egl.c index a899fd6..5407f9c 100755 --- a/src/tpl_wayland_egl.c +++ b/src/tpl_wayland_egl.c @@ -172,14 +172,15 @@ __tpl_wayland_egl_display_is_wl_display(tpl_handle_t native_dpy) /* MAGIC CHECK: A native display handle is a wl_display if the de-referenced first value is a memory address pointing the structure of wl_display_interface. */ - if (wl_egl_native_dpy != &wl_display_interface) - return TPL_FALSE; + if (wl_egl_native_dpy == &wl_display_interface) + return TPL_TRUE; if (strncmp(wl_egl_native_dpy->name, wl_display_interface.name, - strlen(wl_display_interface.name)) != 0) - return TPL_FALSE; + strlen(wl_display_interface.name)) == 0) { + return TPL_TRUE; + } - return TPL_TRUE; + return TPL_FALSE; } static tpl_result_t diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index b4886ff..7b33f0a 100755 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -1355,14 +1355,15 @@ __tpl_display_choose_backend_wl_egl_thread(tpl_handle_t native_dpy) /* MAGIC CHECK: A native display handle is a wl_display if the de-referenced first value is a memory address pointing the structure of wl_display_interface. */ - if (wl_egl_native_dpy != &wl_display_interface) - return TPL_FALSE; + if (wl_egl_native_dpy == &wl_display_interface) + return TPL_TRUE; if (strncmp(wl_egl_native_dpy->name, wl_display_interface.name, - strlen(wl_display_interface.name)) != 0) - return TPL_FALSE; + strlen(wl_display_interface.name)) == 0) { + return TPL_TRUE; + } - return TPL_TRUE; + return TPL_FALSE; } /* -- BEGIN -- wl_egl_window callback functions */ diff --git a/src/tpl_wl_vk_thread.c b/src/tpl_wl_vk_thread.c index ccdd879..d6be95b 100644 --- a/src/tpl_wl_vk_thread.c +++ b/src/tpl_wl_vk_thread.c @@ -99,7 +99,7 @@ struct _tpl_wl_vk_swapchain { tbm_surface_h *swapchain_buffers; - /* [TEMP] To fix dEQP-VK.wsi.wayland.swapchain.modify.resize crash issue + /* [TEMP] To fix dEQP-VK.wsi.wayland.swapchain.modify.resize crash issue * It will be fixed properly using old_swapchain handle */ tbm_surface_h *old_swapchain_buffers; @@ -239,16 +239,22 @@ _check_native_handle_is_wl_display(tpl_handle_t native_dpy) { struct wl_interface *wl_vk_native_dpy = *(void **) native_dpy; + if (!wl_vk_native_dpy) { + TPL_ERR("Invalid parameter. native_display(%p)", wl_vk_native_dpy); + return TPL_FALSE; + } + /* MAGIC CHECK: A native display handle is a wl_display if the de-referenced first value is a memory address pointing the structure of wl_display_interface. */ - if (wl_vk_native_dpy != &wl_display_interface) - return TPL_FALSE; + if (wl_vk_native_dpy == &wl_display_interface) + return TPL_TRUE; if (strncmp(wl_vk_native_dpy->name, wl_display_interface.name, - strlen(wl_display_interface.name)) != 0) - return TPL_FALSE; + strlen(wl_display_interface.name)) == 0) { + return TPL_TRUE; + } - return TPL_TRUE; + return TPL_FALSE; } static tpl_bool_t @@ -1807,7 +1813,7 @@ void __untrack_swapchain_buffers(tpl_wl_vk_surface_t *wl_vk_surface, tbm_surface _get_tbm_surface_bo_name(sc_buffers[i])); tbm_surface_internal_unref(sc_buffers[i]); sc_buffers[i] = NULL; - } + } } }