ImVector: added clear_delete(), clear_destruct() helpers.

This commit is contained in:
ocornut
2021-06-09 16:57:35 +02:00
parent 61f4aec868
commit d0c6dd9baf
4 changed files with 14 additions and 22 deletions

View File

@ -2927,8 +2927,7 @@ ImGuiWindow::~ImGuiWindow()
{
IM_ASSERT(DrawList == &DrawListInst);
IM_DELETE(Name);
for (int i = 0; i != ColumnsStorage.Size; i++)
ColumnsStorage[i].~ImGuiOldColumns();
ColumnsStorage.clear_destruct();
}
ImGuiID ImGuiWindow::GetID(const char* str, const char* str_end)
@ -4189,9 +4188,7 @@ void ImGui::Shutdown(ImGuiContext* context)
CallContextHooks(&g, ImGuiContextHookType_Shutdown);
// Clear everything else
for (int i = 0; i < g.Windows.Size; i++)
IM_DELETE(g.Windows[i]);
g.Windows.clear();
g.Windows.clear_delete();
g.WindowsFocusOrder.clear();
g.WindowsTempSortBuffer.clear();
g.CurrentWindow = NULL;
@ -4207,18 +4204,14 @@ void ImGui::Shutdown(ImGuiContext* context)
g.OpenPopupStack.clear();
g.BeginPopupStack.clear();
for (int i = 0; i < g.Viewports.Size; i++)
IM_DELETE(g.Viewports[i]);
g.Viewports.clear();
g.Viewports.clear_delete();
g.TabBars.Clear();
g.CurrentTabBarStack.clear();
g.ShrinkWidthBuffer.clear();
g.Tables.Clear();
for (int i = 0; i < g.TablesTempDataStack.Size; i++)
g.TablesTempDataStack[i].~ImGuiTableTempData();
g.TablesTempDataStack.clear();
g.TablesTempDataStack.clear_destruct();
g.DrawChannelsTempMergeBuffer.clear();
g.ClipboardHandlerData.clear();