From bce3e498e8e5fee7f42c3b44ecdd7cecab75c0af Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sat, 16 Aug 2025 12:08:58 +0200 Subject: [PATCH] Fix destruction of textures still in use --- client/render/imgui_impl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/render/imgui_impl.cpp b/client/render/imgui_impl.cpp index 53d59862..1f762af9 100644 --- a/client/render/imgui_impl.cpp +++ b/client/render/imgui_impl.cpp @@ -1099,6 +1099,13 @@ ImTextureID imgui_context::load_texture(const std::string & filename) void imgui_context::free_texture(ImTextureID texture) { + // Make sure we are done using the texture + std::vector fences; + for (auto & f: command_buffers) + fences.push_back(*f.fence); + if (auto result = device.waitForFences(fences, true, 1'000'000'000); result != vk::Result::eSuccess) + spdlog::error("vkWaitForfences: {}", vk::to_string(result)); + textures.erase(texture); }