mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Tables: Fixed holding on table pointers accross resize/invalidation of the pool buffer.
This commit is contained in:
parent
931829f701
commit
8ec05fc034
@ -2931,7 +2931,7 @@ static void SetCurrentWindow(ImGuiWindow* window)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.CurrentWindow = window;
|
||||
g.CurrentTable = window ? window->DC.CurrentTable : NULL;
|
||||
g.CurrentTable = window && window->DC.CurrentTableIdx != -1 ? g.Tables.GetByIndex(window->DC.CurrentTableIdx) : NULL;
|
||||
if (window)
|
||||
g.FontSize = g.DrawListSharedData.FontSize = window->CalcFontSize();
|
||||
}
|
||||
@ -5623,6 +5623,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
window->ClipRect = ImVec4(-FLT_MAX, -FLT_MAX, +FLT_MAX, +FLT_MAX);
|
||||
window->IDStack.resize(1);
|
||||
window->DrawList->_ResetForNewFrame();
|
||||
window->DC.CurrentTableIdx = -1;
|
||||
|
||||
// Restore buffer capacity when woken from a compacted state, to avoid
|
||||
if (window->MemoryCompacted)
|
||||
|
@ -1657,7 +1657,7 @@ struct IMGUI_API ImGuiWindowTempData
|
||||
ImVector<ImGuiWindow*> ChildWindows;
|
||||
ImGuiStorage* StateStorage; // Current persistent per-window storage (store e.g. tree node open/close state)
|
||||
ImGuiOldColumns* CurrentColumns; // Current columns set
|
||||
ImGuiTable* CurrentTable; // Current table set
|
||||
int CurrentTableIdx; // Current table index (into g.Tables)
|
||||
ImGuiLayoutType LayoutType;
|
||||
ImGuiLayoutType ParentLayoutType; // Layout type of parent window at the time of Begin()
|
||||
int FocusCounterRegular; // (Legacy Focus/Tabbing system) Sequential counter, start at -1 and increase as assigned via FocusableItemRegister() (FIXME-NAV: Needs redesign)
|
||||
|
@ -305,11 +305,12 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
||||
table->BorderX2 = table->InnerClipRect.Max.x;// +((table->Flags & ImGuiTableFlags_BordersOuter) ? 0.0f : +1.0f);
|
||||
|
||||
// Make table current
|
||||
g.CurrentTableStack.push_back(ImGuiPtrOrIndex(g.Tables.GetIndex(table)));
|
||||
const int table_idx = g.Tables.GetIndex(table);
|
||||
g.CurrentTableStack.push_back(ImGuiPtrOrIndex(table_idx));
|
||||
g.CurrentTable = table;
|
||||
outer_window->DC.CurrentTable = table;
|
||||
outer_window->DC.CurrentTableIdx = table_idx;
|
||||
if (inner_window != outer_window) // So EndChild() within the inner window can restore the table properly.
|
||||
inner_window->DC.CurrentTable = table;
|
||||
inner_window->DC.CurrentTableIdx = table_idx;
|
||||
if ((table_last_flags & ImGuiTableFlags_Reorderable) && !(flags & ImGuiTableFlags_Reorderable))
|
||||
table->IsResetDisplayOrderRequest = true;
|
||||
|
||||
@ -1116,7 +1117,8 @@ void ImGui::EndTable()
|
||||
IM_ASSERT(g.CurrentWindow == outer_window);
|
||||
IM_ASSERT(g.CurrentTable == table);
|
||||
g.CurrentTableStack.pop_back();
|
||||
outer_window->DC.CurrentTable = g.CurrentTable = g.CurrentTableStack.Size ? g.Tables.GetByIndex(g.CurrentTableStack.back().Index) : NULL;
|
||||
g.CurrentTable = g.CurrentTableStack.Size ? g.Tables.GetByIndex(g.CurrentTableStack.back().Index) : NULL;
|
||||
outer_window->DC.CurrentTableIdx = g.CurrentTable ? g.Tables.GetIndex(g.CurrentTable) : -1;
|
||||
}
|
||||
|
||||
// FIXME-TABLE: This is a mess, need to redesign how we render borders.
|
||||
|
Loading…
Reference in New Issue
Block a user