MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / Shutdown

Method Shutdown

plugins/Cardinal/src/DearImGui/imgui.cpp:4230–4303  ·  view source on GitHub ↗

This function is merely here to free heap allocations.

Source from the content-addressed store, hash-verified

4228
4229// This function is merely here to free heap allocations.
4230void ImGui::Shutdown(ImGuiContext* context)
4231{
4232 // 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)
4233 ImGuiContext& g = *context;
4234 if (g.IO.Fonts && g.FontAtlasOwnedByContext)
4235 {
4236 g.IO.Fonts->Locked = false;
4237 IM_DELETE(g.IO.Fonts);
4238 }
4239 g.IO.Fonts = NULL;
4240
4241 // Cleanup of other data are conditional on actually having initialized Dear ImGui.
4242 if (!g.Initialized)
4243 return;
4244
4245 // Save settings (unless we haven't attempted to load them: CreateContext/DestroyContext without a call to NewFrame shouldn't save an empty file)
4246 if (g.SettingsLoaded && g.IO.IniFilename != NULL)
4247 {
4248 ImGuiContext* backup_context = GImGui;
4249 SetCurrentContext(&g);
4250 SaveIniSettingsToDisk(g.IO.IniFilename);
4251 SetCurrentContext(backup_context);
4252 }
4253
4254 CallContextHooks(&g, ImGuiContextHookType_Shutdown);
4255
4256 // Clear everything else
4257 g.Windows.clear_delete();
4258 g.WindowsFocusOrder.clear();
4259 g.WindowsTempSortBuffer.clear();
4260 g.CurrentWindow = NULL;
4261 g.CurrentWindowStack.clear();
4262 g.WindowsById.Clear();
4263 g.NavWindow = NULL;
4264 g.HoveredWindow = g.HoveredWindowUnderMovingWindow = NULL;
4265 g.ActiveIdWindow = g.ActiveIdPreviousFrameWindow = NULL;
4266 g.MovingWindow = NULL;
4267 g.ColorStack.clear();
4268 g.StyleVarStack.clear();
4269 g.FontStack.clear();
4270 g.OpenPopupStack.clear();
4271 g.BeginPopupStack.clear();
4272
4273 g.Viewports.clear_delete();
4274
4275 g.TabBars.Clear();
4276 g.CurrentTabBarStack.clear();
4277 g.ShrinkWidthBuffer.clear();
4278
4279 g.ClipperTempData.clear_destruct();
4280
4281 g.Tables.Clear();
4282 g.TablesTempData.clear_destruct();
4283 g.DrawChannelsTempMergeBuffer.clear();
4284
4285 g.ClipboardHandlerData.clear();
4286 g.MenusIdSubmittedThisFrame.clear();
4287 g.InputTextState.ClearFreeMemory();

Callers

nothing calls this directly

Calls 5

IM_DELETEFunction · 0.85
ImFileCloseFunction · 0.70
clearMethod · 0.45
ClearMethod · 0.45
ClearFreeMemoryMethod · 0.45

Tested by

no test coverage detected