This function is merely here to free heap allocations.
| 3864 | |
| 3865 | // This function is merely here to free heap allocations. |
| 3866 | void ImGui::Shutdown(ImGuiContext* context) |
| 3867 | { |
| 3868 | // 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) |
| 3869 | ImGuiContext& g = *context; |
| 3870 | if (g.IO.Fonts && g.FontAtlasOwnedByContext) |
| 3871 | { |
| 3872 | g.IO.Fonts->Locked = false; |
| 3873 | IM_DELETE(g.IO.Fonts); |
| 3874 | } |
| 3875 | g.IO.Fonts = NULL; |
| 3876 | |
| 3877 | // Cleanup of other data are conditional on actually having initialized Dear ImGui. |
| 3878 | if (!g.Initialized) |
| 3879 | return; |
| 3880 | |
| 3881 | // Save settings (unless we haven't attempted to load them: CreateContext/DestroyContext without a call to NewFrame shouldn't save an empty file) |
| 3882 | if (g.SettingsLoaded && g.IO.IniFilename != NULL) |
| 3883 | { |
| 3884 | ImGuiContext* backup_context = GImGui; |
| 3885 | SetCurrentContext(context); |
| 3886 | SaveIniSettingsToDisk(g.IO.IniFilename); |
| 3887 | SetCurrentContext(backup_context); |
| 3888 | } |
| 3889 | |
| 3890 | // Clear everything else |
| 3891 | for (int i = 0; i < g.Windows.Size; i++) |
| 3892 | IM_DELETE(g.Windows[i]); |
| 3893 | g.Windows.clear(); |
| 3894 | g.WindowsFocusOrder.clear(); |
| 3895 | g.WindowsTempSortBuffer.clear(); |
| 3896 | g.CurrentWindow = NULL; |
| 3897 | g.CurrentWindowStack.clear(); |
| 3898 | g.WindowsById.Clear(); |
| 3899 | g.NavWindow = NULL; |
| 3900 | g.HoveredWindow = g.HoveredRootWindow = NULL; |
| 3901 | g.ActiveIdWindow = g.ActiveIdPreviousFrameWindow = NULL; |
| 3902 | g.MovingWindow = NULL; |
| 3903 | g.ColorModifiers.clear(); |
| 3904 | g.StyleModifiers.clear(); |
| 3905 | g.FontStack.clear(); |
| 3906 | g.OpenPopupStack.clear(); |
| 3907 | g.BeginPopupStack.clear(); |
| 3908 | g.DrawDataBuilder.ClearFreeMemory(); |
| 3909 | g.BackgroundDrawList.ClearFreeMemory(); |
| 3910 | g.ForegroundDrawList.ClearFreeMemory(); |
| 3911 | |
| 3912 | g.TabBars.Clear(); |
| 3913 | g.CurrentTabBarStack.clear(); |
| 3914 | g.ShrinkWidthBuffer.clear(); |
| 3915 | |
| 3916 | g.PrivateClipboard.clear(); |
| 3917 | g.InputTextState.ClearFreeMemory(); |
| 3918 | |
| 3919 | g.SettingsWindows.clear(); |
| 3920 | g.SettingsHandlers.clear(); |
| 3921 | |
| 3922 | if (g.LogFile) |
| 3923 | { |
nothing calls this directly
no test coverage detected