diff --git a/Source/ImGui/Private/ImGuiContext.cpp b/Source/ImGui/Private/ImGuiContext.cpp index bb5f274..1419abe 100644 --- a/Source/ImGui/Private/ImGuiContext.cpp +++ b/Source/ImGui/Private/ImGuiContext.cpp @@ -447,8 +447,13 @@ FImGuiContext::~FImGuiContext() } } + ImGuiContext* PreviousContext = ImGui::GetCurrentContext(); + ImGui::SetCurrentContext(Context); + ImGui::DestroyPlatformWindows(); - ImGui::DestroyContext(Context); + ImGui::DestroyContext(); + + ImGui::SetCurrentContext(PreviousContext); Context = nullptr; } }