From 81bf217af2ddeb2660aae170fe4ef57f2efd0cc9 Mon Sep 17 00:00:00 2001 From: Sixze <16257871+Sixze@users.noreply.github.com> Date: Tue, 24 Mar 2026 00:53:06 +0300 Subject: [PATCH] Fix a crash when stopping multiple PIE sessions at the same time --- Source/ImGui/Private/ImGuiContext.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; } }