This function is merely here to free heap allocations.
| 3604 | |
| 3605 | // This function is merely here to free heap allocations. |
| 3606 | void ImGui::Shutdown() |
| 3607 | { |
| 3608 | // 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) |
| 3609 | ImGuiContext& g = *GImGui; |
| 3610 | if (g.IO.Fonts && g.FontAtlasOwnedByContext) |
| 3611 | { |
| 3612 | g.IO.Fonts->Locked = false; |
| 3613 | IM_DELETE(g.IO.Fonts); |
| 3614 | } |
| 3615 | g.IO.Fonts = NULL; |
| 3616 | g.DrawListSharedData.TempBuffer.clear(); |
| 3617 | |
| 3618 | // Cleanup of other data are conditional on actually having initialized Dear ImGui. |
| 3619 | if (!g.Initialized) |
| 3620 | return; |
| 3621 | |
| 3622 | // Save settings (unless we haven't attempted to load them: CreateContext/DestroyContext without a call to NewFrame shouldn't save an empty file) |
| 3623 | if (g.SettingsLoaded && g.IO.IniFilename != NULL) |
| 3624 | SaveIniSettingsToDisk(g.IO.IniFilename); |
| 3625 | |
| 3626 | CallContextHooks(&g, ImGuiContextHookType_Shutdown); |
| 3627 | |
| 3628 | // Clear everything else |
| 3629 | g.Windows.clear_delete(); |
| 3630 | g.WindowsFocusOrder.clear(); |
| 3631 | g.WindowsTempSortBuffer.clear(); |
| 3632 | g.CurrentWindow = NULL; |
| 3633 | g.CurrentWindowStack.clear(); |
| 3634 | g.WindowsById.Clear(); |
| 3635 | g.NavWindow = NULL; |
| 3636 | g.HoveredWindow = g.HoveredWindowUnderMovingWindow = NULL; |
| 3637 | g.ActiveIdWindow = g.ActiveIdPreviousFrameWindow = NULL; |
| 3638 | g.MovingWindow = NULL; |
| 3639 | |
| 3640 | g.KeysRoutingTable.Clear(); |
| 3641 | |
| 3642 | g.ColorStack.clear(); |
| 3643 | g.StyleVarStack.clear(); |
| 3644 | g.FontStack.clear(); |
| 3645 | g.OpenPopupStack.clear(); |
| 3646 | g.BeginPopupStack.clear(); |
| 3647 | g.NavTreeNodeStack.clear(); |
| 3648 | |
| 3649 | g.Viewports.clear_delete(); |
| 3650 | |
| 3651 | g.TabBars.Clear(); |
| 3652 | g.CurrentTabBarStack.clear(); |
| 3653 | g.ShrinkWidthBuffer.clear(); |
| 3654 | |
| 3655 | g.ClipperTempData.clear_destruct(); |
| 3656 | |
| 3657 | g.Tables.Clear(); |
| 3658 | g.TablesTempData.clear_destruct(); |
| 3659 | g.DrawChannelsTempMergeBuffer.clear(); |
| 3660 | |
| 3661 | g.ClipboardHandlerData.clear(); |
| 3662 | g.MenusIdSubmittedThisFrame.clear(); |
| 3663 | g.InputTextState.ClearFreeMemory(); |
nothing calls this directly
no test coverage detected