diff options
author | Kirill Primak <vyivel@eclair.cafe> | 2022-12-22 11:44:55 +0300 |
---|---|---|
committer | Kirill Primak <vyivel@eclair.cafe> | 2022-12-22 12:42:08 +0300 |
commit | faa31d123f7619750f733c22e4d616ed615c7232 (patch) | |
tree | bafeee932bfc694cf0f0805bc274df5b4cd573fb | |
parent | 0702eb9219affa714540488edd44b63718ea83d0 (diff) |
render/vulkan: always finish buffer addon on texture destroy
-rw-r--r-- | render/vulkan/texture.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/render/vulkan/texture.c b/render/vulkan/texture.c index ae6b05c9..705c284c 100644 --- a/render/vulkan/texture.c +++ b/render/vulkan/texture.c @@ -190,6 +190,11 @@ out: } void vulkan_texture_destroy(struct wlr_vk_texture *texture) { + if (texture->buffer != NULL) { + wlr_addon_finish(&texture->buffer_addon); + texture->buffer = NULL; + } + // when we recorded a command to fill this image _this_ frame, // it has to be executed before the texture can be destroyed. // Add it to the renderer->destroy_textures list, destroying @@ -203,10 +208,6 @@ void vulkan_texture_destroy(struct wlr_vk_texture *texture) { wl_list_remove(&texture->link); - if (texture->buffer != NULL) { - wlr_addon_finish(&texture->buffer_addon); - } - VkDevice dev = texture->renderer->dev->dev; if (texture->ds && texture->ds_pool) { vulkan_free_ds(texture->renderer, texture->ds_pool, texture->ds); @@ -736,9 +737,7 @@ static void texture_handle_buffer_destroy(struct wlr_addon *addon) { struct wlr_vk_texture *texture = wl_container_of(addon, texture, buffer_addon); // We might keep the texture around, waiting for pending command buffers to - // complete before free'ing descriptor sets. Make sure we don't - // use-after-free the destroyed wlr_buffer. - texture->buffer = NULL; + // complete before free'ing descriptor sets. vulkan_texture_destroy(texture); } |