Skip to content

Commit 16b2d20

Browse files
committed
Viewports: DestroyContext() does not call DestroyPlatformWindows() anymore. (ocornut#7175, ocornut#8945)
1 parent 8ccff82 commit 16b2d20

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

docs/CHANGELOG.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ Docking+Viewports Branch:
4848
- Nav: fixed a crash that could occur when opening a popup following the processing
4949
of a global shortcut while no windows were focused (the fix done in 1.92.3 was
5050
incomplete for docking branch).
51+
- Viewports: DestroyContext() does not call DestroyPlatformWindows() anymore at
52+
it assumed to be unnecessary as backensd should have done it and we check that
53+
backends have been shutdown since 1.90.4. Changed into asserts. (#7175, #8945)
5154

5255

5356
-----------------------------------------------------------------------

imgui.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4415,6 +4415,11 @@ void ImGui::Shutdown()
44154415
ImGuiContext& g = *GImGui;
44164416
IM_ASSERT_USER_ERROR(g.IO.BackendPlatformUserData == NULL, "Forgot to shutdown Platform backend?");
44174417
IM_ASSERT_USER_ERROR(g.IO.BackendRendererUserData == NULL, "Forgot to shutdown Renderer backend?");
4418+
for (ImGuiViewportP* viewport : g.Viewports)
4419+
{
4420+
IM_UNUSED(viewport);
4421+
IM_ASSERT_USER_ERROR(viewport->RendererUserData == NULL && viewport->PlatformUserData == NULL && viewport->PlatformHandle == NULL, "Backend or app forgot to call DestroyPlatformWindows()?");
4422+
}
44184423

44194424
// The fonts atlas can be used prior to calling NewFrame(), so we clear it even if g.Initialized is FALSE (which would happen if we never called NewFrame)
44204425
for (ImFontAtlas* atlas : g.FontAtlases)
@@ -4436,9 +4441,6 @@ void ImGui::Shutdown()
44364441
if (g.SettingsLoaded && g.IO.IniFilename != NULL)
44374442
SaveIniSettingsToDisk(g.IO.IniFilename);
44384443

4439-
// Destroy platform windows
4440-
DestroyPlatformWindows();
4441-
44424444
// Shutdown extensions
44434445
DockContextShutdown(&g);
44444446

0 commit comments

Comments
 (0)