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;
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;