This function is merely here to free heap allocations.
| 4821 | |
| 4822 | // This function is merely here to free heap allocations. |
| 4823 | void ImGui::Shutdown() |
| 4824 | { |
| 4825 | // 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) |
| 4826 | ImGuiContext& g = *GImGui; |
| 4827 | if (g.IO.Fonts && g.FontAtlasOwnedByContext) |
| 4828 | { |
| 4829 | g.IO.Fonts->Locked = false; |
| 4830 | IM_DELETE(g.IO.Fonts); |
| 4831 | } |
| 4832 | g.IO.Fonts = NULL; |
| 4833 | g.DrawListSharedData.TempBuffer.clear(); |
| 4834 | |
| 4835 | // Cleanup of other data are conditional on actually having initialized Dear ImGui. |
| 4836 | if (!g.Initialized) |
| 4837 | return; |
| 4838 | |
| 4839 | // Save settings (unless we haven't attempted to load them: CreateContext/DestroyContext without a call to NewFrame shouldn't save an empty file) |
| 4840 | if (g.SettingsLoaded && g.IO.IniFilename != NULL) |
| 4841 | SaveIniSettingsToDisk(g.IO.IniFilename); |
| 4842 | |
| 4843 | CallContextHooks(&g, ImGuiContextHookType_Shutdown); |
| 4844 | |
| 4845 | // Clear everything else |
| 4846 | g.Windows.clear_delete(); |
| 4847 | g.WindowsFocusOrder.clear(); |
| 4848 | g.WindowsTempSortBuffer.clear(); |
| 4849 | g.CurrentWindow = NULL; |
| 4850 | g.CurrentWindowStack.clear(); |
| 4851 | g.WindowsById.Clear(); |
| 4852 | g.NavWindow = NULL; |
| 4853 | g.HoveredWindow = g.HoveredWindowUnderMovingWindow = NULL; |
| 4854 | g.ActiveIdWindow = g.ActiveIdPreviousFrameWindow = NULL; |
| 4855 | g.MovingWindow = NULL; |
| 4856 | |
| 4857 | g.KeysRoutingTable.Clear(); |
| 4858 | |
| 4859 | g.ColorStack.clear(); |
| 4860 | g.StyleVarStack.clear(); |
| 4861 | g.FontStack.clear(); |
| 4862 | g.OpenPopupStack.clear(); |
| 4863 | g.BeginPopupStack.clear(); |
| 4864 | |
| 4865 | g.Viewports.clear_delete(); |
| 4866 | |
| 4867 | g.TabBars.Clear(); |
| 4868 | g.CurrentTabBarStack.clear(); |
| 4869 | g.ShrinkWidthBuffer.clear(); |
| 4870 | |
| 4871 | g.ClipperTempData.clear_destruct(); |
| 4872 | |
| 4873 | g.Tables.Clear(); |
| 4874 | g.TablesTempData.clear_destruct(); |
| 4875 | g.DrawChannelsTempMergeBuffer.clear(); |
| 4876 | |
| 4877 | g.ClipboardHandlerData.clear(); |
| 4878 | g.MenusIdSubmittedThisFrame.clear(); |
| 4879 | g.InputTextState.ClearFreeMemory(); |
| 4880 |
nothing calls this directly
no test coverage detected