From 63093d135c8ea68cfda4df2ad52fbbbb798e8c6b Mon Sep 17 00:00:00 2001 From: "joonbum.ko" Date: Mon, 4 Sep 2017 18:17:04 +0900 Subject: [PATCH] tpl_wl_egl_thread: Added some exception checking. Change-Id: I8c4ef999cbd0c8a537cfa2a6cf2f07d877a004ab Signed-off-by: joonbum.ko --- src/tpl_wl_egl_thread.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index 4c2e8a6..eacb73c 100644 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -57,26 +57,22 @@ __tpl_wl_egl_display_init(tpl_display_t *display) display->bufmgr_fd = -1; if (twe_check_native_handle_is_wl_display(display->native_handle)) { - twe_thread *wl_egl_thread = NULL; - twe_display_h twe_display = NULL; - - wl_egl_thread = twe_thread_create(); - if (!wl_egl_thread) { + wayland_egl_display->wl_egl_thread = twe_thread_create(); + if (!wayland_egl_display->wl_egl_thread) { TPL_ERR("Failed to create twe_thread."); goto free_display; } - twe_display = twe_display_add(wl_egl_thread, display->native_handle); - if (!twe_display) { + wayland_egl_display->twe_display = + twe_display_add(wayland_egl_display->wl_egl_thread, + display->native_handle); + if (!wayland_egl_display->twe_display) { TPL_ERR("Failed to add native_display(%p) to thread(%p)", - display->native_handle, wl_egl_thread); - twe_thread_destroy(wl_egl_thread); + display->native_handle, + wayland_egl_display->wl_egl_thread); goto free_display; } - wayland_egl_display->wl_egl_thread = wl_egl_thread; - wayland_egl_display->twe_display = twe_display; - } else { TPL_ERR("Invalid native handle for display."); goto free_display; @@ -91,6 +87,10 @@ __tpl_wl_egl_display_init(tpl_display_t *display) return TPL_ERROR_NONE; free_display: + if (wayland_egl_display->twe_display) + twe_display_del(wayland_egl_display->twe_display); + if (wayland_egl_display->wl_egl_thread) + twe_thread_destroy(wayland_egl_display->wl_egl_thread); wayland_egl_display->wl_egl_thread = NULL; wayland_egl_display->twe_display = NULL; -- 2.7.4