mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 09:27:00 +00:00
Vulkan: Fix crash when viewports are disabled and memory leak on shutdown. (#2698)
This commit is contained in:
parent
a1164399b0
commit
949a9fa2cb
@ -850,8 +850,17 @@ bool ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info, VkRenderPass rend
|
|||||||
|
|
||||||
void ImGui_ImplVulkan_Shutdown()
|
void ImGui_ImplVulkan_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplVulkan_ShutdownPlatformInterface();
|
// First destroy objects in all viewports
|
||||||
ImGui_ImplVulkan_DestroyDeviceObjects();
|
ImGui_ImplVulkan_DestroyDeviceObjects();
|
||||||
|
|
||||||
|
// Manually delete main viewport render data in-case we haven't initialized for viewports
|
||||||
|
ImGuiViewport* main_viewport = ImGui::GetMainViewport();
|
||||||
|
if (ImGuiViewportDataVulkan* data = (ImGuiViewportDataVulkan*)main_viewport->RendererUserData)
|
||||||
|
IM_DELETE(data);
|
||||||
|
main_viewport->RendererUserData = NULL;
|
||||||
|
|
||||||
|
// Clean up windows
|
||||||
|
ImGui_ImplVulkan_ShutdownPlatformInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplVulkan_NewFrame()
|
void ImGui_ImplVulkan_NewFrame()
|
||||||
|
Loading…
Reference in New Issue
Block a user