This function is merely here to free heap allocations.
| 4155 | |
| 4156 | // This function is merely here to free heap allocations. |
| 4157 | void ImGui::Shutdown(ImGuiContext* context) |
| 4158 | { |
| 4159 | // 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) |
| 4160 | ImGuiContext& g = *context; |
| 4161 | if (g.IO.Fonts && g.FontAtlasOwnedByContext) |
| 4162 | { |
| 4163 | g.IO.Fonts->Locked = false; |
| 4164 | IM_DELETE(g.IO.Fonts); |
| 4165 | } |
| 4166 | g.IO.Fonts = NULL; |
| 4167 | |
| 4168 | // Cleanup of other data are conditional on actually having initialized Dear ImGui. |
| 4169 | if (!g.Initialized) |
| 4170 | return; |
| 4171 | |
| 4172 | // Save settings (unless we haven't attempted to load them: CreateContext/DestroyContext without a call to NewFrame shouldn't save an empty file) |
| 4173 | if (g.SettingsLoaded && g.IO.IniFilename != NULL) |
| 4174 | { |
| 4175 | ImGuiContext* backup_context = GImGui; |
| 4176 | SetCurrentContext(&g); |
| 4177 | SaveIniSettingsToDisk(g.IO.IniFilename); |
| 4178 | SetCurrentContext(backup_context); |
| 4179 | } |
| 4180 | |
| 4181 | CallContextHooks(&g, ImGuiContextHookType_Shutdown); |
| 4182 | |
| 4183 | // Clear everything else |
| 4184 | for (int i = 0; i < g.Windows.Size; i++) |
| 4185 | IM_DELETE(g.Windows[i]); |
| 4186 | g.Windows.clear(); |
| 4187 | g.WindowsFocusOrder.clear(); |
| 4188 | g.WindowsTempSortBuffer.clear(); |
| 4189 | g.CurrentWindow = NULL; |
| 4190 | g.CurrentWindowStack.clear(); |
| 4191 | g.WindowsById.Clear(); |
| 4192 | g.NavWindow = NULL; |
| 4193 | g.HoveredWindow = g.HoveredWindowUnderMovingWindow = NULL; |
| 4194 | g.ActiveIdWindow = g.ActiveIdPreviousFrameWindow = NULL; |
| 4195 | g.MovingWindow = NULL; |
| 4196 | g.ColorStack.clear(); |
| 4197 | g.StyleVarStack.clear(); |
| 4198 | g.FontStack.clear(); |
| 4199 | g.OpenPopupStack.clear(); |
| 4200 | g.BeginPopupStack.clear(); |
| 4201 | |
| 4202 | for (int i = 0; i < g.Viewports.Size; i++) |
| 4203 | IM_DELETE(g.Viewports[i]); |
| 4204 | g.Viewports.clear(); |
| 4205 | |
| 4206 | g.TabBars.Clear(); |
| 4207 | g.CurrentTabBarStack.clear(); |
| 4208 | g.ShrinkWidthBuffer.clear(); |
| 4209 | |
| 4210 | g.Tables.Clear(); |
| 4211 | for (int i = 0; i < g.TablesTempDataStack.Size; i++) |
| 4212 | g.TablesTempDataStack[i].~ImGuiTableTempData(); |
| 4213 | g.TablesTempDataStack.clear(); |
| 4214 | g.DrawChannelsTempMergeBuffer.clear(); |
nothing calls this directly
no test coverage detected