This function is merely here to free heap allocations.
| 4317 | |
| 4318 | // This function is merely here to free heap allocations. |
| 4319 | void ImGui::Shutdown() |
| 4320 | { |
| 4321 | ImGuiContext& g = *GImGui; |
| 4322 | IM_ASSERT_USER_ERROR(g.IO.BackendPlatformUserData == NULL, "Forgot to shutdown Platform backend?"); |
| 4323 | IM_ASSERT_USER_ERROR(g.IO.BackendRendererUserData == NULL, "Forgot to shutdown Renderer backend?"); |
| 4324 | |
| 4325 | // 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) |
| 4326 | for (ImFontAtlas* atlas : g.FontAtlases) |
| 4327 | { |
| 4328 | UnregisterFontAtlas(atlas); |
| 4329 | if (atlas->OwnerContext == &g) |
| 4330 | { |
| 4331 | atlas->Locked = false; |
| 4332 | IM_DELETE(atlas); |
| 4333 | } |
| 4334 | } |
| 4335 | g.DrawListSharedData.TempBuffer.clear(); |
| 4336 | |
| 4337 | // Cleanup of other data are conditional on actually having initialized Dear ImGui. |
| 4338 | if (!g.Initialized) |
| 4339 | return; |
| 4340 | |
| 4341 | // Save settings (unless we haven't attempted to load them: CreateContext/DestroyContext without a call to NewFrame shouldn't save an empty file) |
| 4342 | if (g.SettingsLoaded && g.IO.IniFilename != NULL) |
| 4343 | SaveIniSettingsToDisk(g.IO.IniFilename); |
| 4344 | |
| 4345 | CallContextHooks(&g, ImGuiContextHookType_Shutdown); |
| 4346 | |
| 4347 | // Clear everything else |
| 4348 | g.Windows.clear_delete(); |
| 4349 | g.WindowsFocusOrder.clear(); |
| 4350 | g.WindowsTempSortBuffer.clear(); |
| 4351 | g.CurrentWindow = NULL; |
| 4352 | g.CurrentWindowStack.clear(); |
| 4353 | g.WindowsById.Clear(); |
| 4354 | g.NavWindow = NULL; |
| 4355 | g.HoveredWindow = g.HoveredWindowUnderMovingWindow = NULL; |
| 4356 | g.ActiveIdWindow = NULL; |
| 4357 | g.MovingWindow = NULL; |
| 4358 | |
| 4359 | g.KeysRoutingTable.Clear(); |
| 4360 | |
| 4361 | g.ColorStack.clear(); |
| 4362 | g.StyleVarStack.clear(); |
| 4363 | g.FontStack.clear(); |
| 4364 | g.OpenPopupStack.clear(); |
| 4365 | g.BeginPopupStack.clear(); |
| 4366 | g.TreeNodeStack.clear(); |
| 4367 | |
| 4368 | g.Viewports.clear_delete(); |
| 4369 | |
| 4370 | g.TabBars.Clear(); |
| 4371 | g.CurrentTabBarStack.clear(); |
| 4372 | g.ShrinkWidthBuffer.clear(); |
| 4373 | |
| 4374 | g.ClipperTempData.clear_destruct(); |
| 4375 | |
| 4376 | g.Tables.Clear(); |
nothing calls this directly
no test coverage detected