MultiSelect: added missing call on Shutdown(). Better reuse selection buffer.
This commit is contained in:
parent
c3998b70cc
commit
a6adfb2b49
@ -3818,6 +3818,8 @@ void ImGui::Shutdown()
|
|||||||
g.TablesTempData.clear_destruct();
|
g.TablesTempData.clear_destruct();
|
||||||
g.DrawChannelsTempMergeBuffer.clear();
|
g.DrawChannelsTempMergeBuffer.clear();
|
||||||
|
|
||||||
|
g.MultiSelectStorage.Clear();
|
||||||
|
|
||||||
g.ClipboardHandlerData.clear();
|
g.ClipboardHandlerData.clear();
|
||||||
g.MenusIdSubmittedThisFrame.clear();
|
g.MenusIdSubmittedThisFrame.clear();
|
||||||
g.InputTextState.ClearFreeMemory();
|
g.InputTextState.ClearFreeMemory();
|
||||||
|
@ -2818,7 +2818,7 @@ struct ExampleSelection
|
|||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
ExampleSelection() { Clear(); }
|
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); }
|
void Swap(ExampleSelection& rhs) { Storage.Data.swap(rhs.Storage.Data); }
|
||||||
bool Contains(ImGuiID key) const { return Storage.GetInt(key, 0) != 0; }
|
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++; }
|
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();
|
Clear();
|
||||||
|
|
||||||
if (ms_io->RequestSelectAll)
|
if (ms_io->RequestSelectAll)
|
||||||
|
{
|
||||||
|
Storage.Data.reserve(items_count);
|
||||||
for (int idx = 0; idx < items_count; idx++)
|
for (int idx = 0; idx < items_count; idx++)
|
||||||
AddItem(adapter->IndexToStorage(adapter, idx));
|
AddItem(adapter->IndexToStorage(adapter, idx));
|
||||||
|
}
|
||||||
|
|
||||||
if (ms_io->RequestSetRange)
|
if (ms_io->RequestSetRange)
|
||||||
for (int idx = (int)ms_io->RangeFirstItem; idx <= (int)ms_io->RangeLastItem; idx++)
|
for (int idx = (int)ms_io->RangeFirstItem; idx <= (int)ms_io->RangeLastItem; idx++)
|
||||||
|
Loading…
Reference in New Issue
Block a user