diff --git a/base/VulkanUIOverlay.cpp b/base/VulkanUIOverlay.cpp
index 546bd38f563225c18ef47c420d4f559a664a09bd..3b31d14bb38a53060254840e7653ba89b47331a0 100644
--- a/base/VulkanUIOverlay.cpp
+++ b/base/VulkanUIOverlay.cpp
@@ -50,7 +50,9 @@ namespace vks
io.FontGlobalScale = scale;
}
- UIOverlay::~UIOverlay() { }
+ UIOverlay::~UIOverlay() {
+ ImGui::DestroyContext();
+ }
/** Prepare all vulkan resources required to render the UI overlay */
void UIOverlay::prepareResources()
@@ -397,7 +399,6 @@ namespace vks
void UIOverlay::freeResources()
{
- ImGui::DestroyContext();
vertexBuffer.destroy();
indexBuffer.destroy();
vkDestroyImageView(device->logicalDevice, fontView, nullptr);