Skip to content

Commit

Permalink
Viewport: fix to allow multiple shutdown / calls to DestroyPlatformWi…
Browse files Browse the repository at this point in the history
…ndows(). (#2769)
  • Loading branch information
ocornut committed Sep 17, 2019
1 parent 575df6f commit 1ca6ff9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11173,7 +11173,11 @@ void ImGui::DestroyPlatformWindow(ImGuiViewportP* viewport)
if (g.PlatformIO.Platform_DestroyWindow)
g.PlatformIO.Platform_DestroyWindow(viewport);
IM_ASSERT(viewport->RendererUserData == NULL && viewport->PlatformUserData == NULL);
viewport->PlatformWindowCreated = false;

// Don't clear PlatformWindowCreated for the main viewport, as we initially set that up to true in Initialize()
// The right-er way may be to leave it to the back-end to set this flag all-together, and made the flag public.
if (viewport->ID != IMGUI_VIEWPORT_DEFAULT_ID)
viewport->PlatformWindowCreated = false;
}
else
{
Expand Down

0 comments on commit 1ca6ff9

Please sign in to comment.