From: deasung.kim Date: Thu, 22 Sep 2016 07:09:27 +0000 (+0900) Subject: swapchain: fix management of tpl_display reference count X-Git-Tag: submit/submit/tizen/20170906.070327/20170906.070422~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F01%2F89101%2F3;p=platform%2Fcore%2Fuifw%2Fvulkan-wsi-tizen.git swapchain: fix management of tpl_display reference count increase reference count of tpl_display when the vulkan-wsi-tizen calls tpl_display_get() it prevents segfault/abort when the vk_DestroySwapchainKHR is called. Change-Id: I89e8162bbe63682e7617d1279b83b2af33fed942 --- diff --git a/src/wsi/swapchain.c b/src/wsi/swapchain.c index f2e3626..8d5be33 100644 --- a/src/wsi/swapchain.c +++ b/src/wsi/swapchain.c @@ -208,12 +208,12 @@ vk_DestroySwapchainKHR(VkDevice device, tpl_surface_destroy_swapchain(chain->tpl_surface); free(chain->buffers); - if (chain->tpl_display) - tpl_object_unreference((tpl_object_t *)chain->tpl_display); - if (chain->tpl_surface) tpl_object_unreference((tpl_object_t *)chain->tpl_surface); + if (chain->tpl_display) + tpl_object_unreference((tpl_object_t *)chain->tpl_display); + vk_free(&chain->allocator, chain); } diff --git a/src/wsi/wsi.h b/src/wsi/wsi.h index 4e52c39..9539a57 100644 --- a/src/wsi/wsi.h +++ b/src/wsi/wsi.h @@ -89,8 +89,10 @@ static inline tpl_display_t * vk_get_tpl_display(tpl_handle_t native_dpy) { tpl_display_t *display = tpl_display_create(TPL_BACKEND_WAYLAND_VULKAN_WSI, native_dpy); - if (display == NULL) + if (display == NULL) { display = tpl_display_get(native_dpy); + tpl_object_reference((tpl_object_t *)display); + } return display; };