swapchain_tpl: Fixed wrong managing of tpl objects. 17/189417/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Mon, 17 Sep 2018 11:48:11 +0000 (20:48 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Mon, 17 Sep 2018 11:48:16 +0000 (20:48 +0900)
Change-Id: I6ecfc05b03081764ff0752e5ef2a838b84c672f6
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/wsi/swapchain_tpl.c

index a62a256..35117c4 100644 (file)
@@ -142,11 +142,15 @@ swapchain_tpl_deinit(VkDevice              device,
        if (swapchain_tpl) {
                tpl_surface_destroy_swapchain(swapchain_tpl->tpl_surface);
 
-               if (swapchain_tpl->tpl_surface)
+               if (swapchain_tpl->tpl_surface) {
                        tpl_object_unreference((tpl_object_t *)swapchain_tpl->tpl_surface);
+                       swapchain_tpl->tpl_surface = NULL;
+               }
 
-               if (swapchain_tpl->tpl_display)
+               if (swapchain_tpl->tpl_display) {
                        tpl_object_unreference((tpl_object_t *)swapchain_tpl->tpl_display);
+                       swapchain_tpl->tpl_display = NULL;
+               }
 
                vk_free(chain->allocator, swapchain_tpl);
        }
@@ -226,7 +230,7 @@ swapchain_tpl_init(VkDevice                                                  device,
                                                                                                                native_window,
                                                                                                                TPL_SURFACE_TYPE_WINDOW, format);
        else
-               tpl_object_reference((tpl_object_t *)swapchain_tpl->tpl_surface);
+               tpl_object_unreference((tpl_object_t *)swapchain_tpl->tpl_display);
 
 
        VK_CHECK(swapchain_tpl->tpl_surface, goto error, "tpl_surface_create() failed.\n");