diff --git a/imgui.cpp b/imgui.cpp index 59c7580bb..f932e4efa 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3818,6 +3818,8 @@ void ImGui::Shutdown() g.TablesTempData.clear_destruct(); g.DrawChannelsTempMergeBuffer.clear(); + g.MultiSelectStorage.Clear(); + g.ClipboardHandlerData.clear(); g.MenusIdSubmittedThisFrame.clear(); g.InputTextState.ClearFreeMemory(); diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 93addbb1c..59b7162ac 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -2818,7 +2818,7 @@ struct ExampleSelection // Functions ExampleSelection() { Clear(); } - void Clear() { Storage.Clear(); Size = 0; QueueDeletion = false; } + void Clear() { Storage.Data.resize(0); Size = 0; QueueDeletion = false; } void Swap(ExampleSelection& rhs) { Storage.Data.swap(rhs.Storage.Data); } bool Contains(ImGuiID key) const { return Storage.GetInt(key, 0) != 0; } void AddItem(ImGuiID key) { int* p_int = Storage.GetIntRef(key, 0); if (*p_int != 0) return; *p_int = 1; Size++; } @@ -2849,8 +2849,11 @@ struct ExampleSelection Clear(); if (ms_io->RequestSelectAll) + { + Storage.Data.reserve(items_count); for (int idx = 0; idx < items_count; idx++) AddItem(adapter->IndexToStorage(adapter, idx)); + } if (ms_io->RequestSetRange) for (int idx = (int)ms_io->RangeFirstItem; idx <= (int)ms_io->RangeLastItem; idx++)