This function is merely here to free heap allocations.
| 5070 | |
| 5071 | // This function is merely here to free heap allocations. |
| 5072 | void ImGui::Shutdown() |
| 5073 | { |
| 5074 | // 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) |
| 5075 | ImGuiContext& g = *GImGui; |
| 5076 | if (g.IO.Fonts && g.FontAtlasOwnedByContext) |
| 5077 | { |
| 5078 | g.IO.Fonts->Locked = false; |
| 5079 | IM_DELETE(g.IO.Fonts); |
| 5080 | } |
| 5081 | g.IO.Fonts = NULL; |
| 5082 | g.DrawListSharedData.TempBuffer.clear(); |
| 5083 | |
| 5084 | // Cleanup of other data are conditional on actually having initialized Dear ImGui. |
| 5085 | if (!g.Initialized) |
| 5086 | return; |
| 5087 | |
| 5088 | // Save settings (unless we haven't attempted to load them: CreateContext/DestroyContext without a call to NewFrame shouldn't save an empty file) |
| 5089 | if (g.SettingsLoaded && g.IO.IniFilename != NULL) |
| 5090 | SaveIniSettingsToDisk(g.IO.IniFilename); |
| 5091 | |
| 5092 | // Destroy platform windows |
| 5093 | DestroyPlatformWindows(); |
| 5094 | |
| 5095 | // Shutdown extensions |
| 5096 | DockContextShutdown(&g); |
| 5097 | |
| 5098 | CallContextHooks(&g, ImGuiContextHookType_Shutdown); |
| 5099 | |
| 5100 | // Clear everything else |
| 5101 | g.Windows.clear_delete(); |
| 5102 | g.WindowsFocusOrder.clear(); |
| 5103 | g.WindowsTempSortBuffer.clear(); |
| 5104 | g.CurrentWindow = NULL; |
| 5105 | g.CurrentWindowStack.clear(); |
| 5106 | g.WindowsById.Clear(); |
| 5107 | g.NavWindow = NULL; |
| 5108 | g.HoveredWindow = g.HoveredWindowUnderMovingWindow = NULL; |
| 5109 | g.ActiveIdWindow = g.ActiveIdPreviousFrameWindow = NULL; |
| 5110 | g.MovingWindow = NULL; |
| 5111 | |
| 5112 | g.KeysRoutingTable.Clear(); |
| 5113 | |
| 5114 | g.ColorStack.clear(); |
| 5115 | g.StyleVarStack.clear(); |
| 5116 | g.FontStack.clear(); |
| 5117 | g.OpenPopupStack.clear(); |
| 5118 | g.BeginPopupStack.clear(); |
| 5119 | |
| 5120 | g.CurrentViewport = g.MouseViewport = g.MouseLastHoveredViewport = NULL; |
| 5121 | g.Viewports.clear_delete(); |
| 5122 | |
| 5123 | g.TabBars.Clear(); |
| 5124 | g.CurrentTabBarStack.clear(); |
| 5125 | g.ShrinkWidthBuffer.clear(); |
| 5126 | |
| 5127 | g.ClipperTempData.clear_destruct(); |
| 5128 | |
| 5129 | g.Tables.Clear(); |
nothing calls this directly
no test coverage detected