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);
}
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");