mirror of
https://github.com/ocornut/imgui.git
synced 2026-04-04 22:59:43 +00:00
MultiSelect: Clarify and better enforce lifetime of BeginMultiSelect() value.
This commit is contained in:
@@ -7131,6 +7131,7 @@ static void DebugLogMultiSelectRequests(const char* function, const ImGuiMultiSe
|
||||
if (data->RequestSetRange) IMGUI_DEBUG_LOG_SELECTION("[selection] %s: RequestSetRange %p..%p = %d (dir %+d)\n", function, data->RangeSrcItem, data->RangeDstItem, data->RangeSelected, data->RangeDirection);
|
||||
}
|
||||
|
||||
// Return ImGuiMultiSelectIO structure. Lifetime: valid until corresponding call to EndMultiSelect().
|
||||
ImGuiMultiSelectIO* ImGui::BeginMultiSelect(ImGuiMultiSelectFlags flags, void* range_ref, bool range_ref_is_selected)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
@@ -7184,6 +7185,7 @@ ImGuiMultiSelectIO* ImGui::BeginMultiSelect(ImGuiMultiSelectFlags flags, void* r
|
||||
return &ms->BeginIO;
|
||||
}
|
||||
|
||||
// Return updated ImGuiMultiSelectIO structure. Lifetime: until EndFrame() or next BeginMultiSelect() call.
|
||||
ImGuiMultiSelectIO* ImGui::EndMultiSelect()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
@@ -7205,6 +7207,7 @@ ImGuiMultiSelectIO* ImGui::EndMultiSelect()
|
||||
ms->FocusScopeId = 0;
|
||||
ms->Window = NULL;
|
||||
ms->Flags = ImGuiMultiSelectFlags_None;
|
||||
ms->BeginIO.Clear(); // Invalidate contents of BeginMultiSelect() to enforce scope.
|
||||
PopFocusScope();
|
||||
g.CurrentMultiSelect = NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user