mirror of
https://github.com/ocornut/imgui.git
synced 2024-09-23 19:18:34 +02:00
Error Handling: fixed an issue ErrorCheckEndWindowRecover() when aborting in a child inside a tab bar. (#1651)
This commit is contained in:
parent
7f81fbc542
commit
bc77041b57
@ -10242,7 +10242,6 @@ void ImGui::ErrorLogCallbackToDebugLog(void*, const char* fmt, ...)
|
|||||||
// Must be called during or before EndFrame().
|
// Must be called during or before EndFrame().
|
||||||
// This is generally flawed as we are not necessarily End/Popping things in the right order.
|
// This is generally flawed as we are not necessarily End/Popping things in the right order.
|
||||||
// FIXME: Can't recover from inside BeginTabItem/EndTabItem yet.
|
// FIXME: Can't recover from inside BeginTabItem/EndTabItem yet.
|
||||||
// FIXME: Can't recover from interleaved BeginTabBar/Begin
|
|
||||||
void ImGui::ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data)
|
void ImGui::ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data)
|
||||||
{
|
{
|
||||||
// PVS-Studio V1044 is "Loop break conditions do not depend on the number of iterations"
|
// PVS-Studio V1044 is "Loop break conditions do not depend on the number of iterations"
|
||||||
@ -10273,7 +10272,7 @@ void ImGui::ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, voi
|
|||||||
void ImGui::ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, void* user_data)
|
void ImGui::ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, void* user_data)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
while (g.CurrentTable && (g.CurrentTable->OuterWindow == g.CurrentWindow || g.CurrentTable->InnerWindow == g.CurrentWindow))
|
while (g.CurrentTable != NULL && g.CurrentTable->InnerWindow == g.CurrentWindow)
|
||||||
{
|
{
|
||||||
if (log_callback) log_callback(user_data, "Recovered from missing EndTable() in '%s'\n", g.CurrentTable->OuterWindow->Name);
|
if (log_callback) log_callback(user_data, "Recovered from missing EndTable() in '%s'\n", g.CurrentTable->OuterWindow->Name);
|
||||||
EndTable();
|
EndTable();
|
||||||
@ -10282,7 +10281,7 @@ void ImGui::ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, vo
|
|||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
ImGuiStackSizes* stack_sizes = &g.CurrentWindowStack.back().StackSizesOnBegin;
|
ImGuiStackSizes* stack_sizes = &g.CurrentWindowStack.back().StackSizesOnBegin;
|
||||||
IM_ASSERT(window != NULL);
|
IM_ASSERT(window != NULL);
|
||||||
while (g.CurrentTabBar != NULL) //-V1044
|
while (g.CurrentTabBar != NULL && g.CurrentTabBar->Window == window) //-V1044
|
||||||
{
|
{
|
||||||
if (log_callback) log_callback(user_data, "Recovered from missing EndTabBar() in '%s'\n", window->Name);
|
if (log_callback) log_callback(user_data, "Recovered from missing EndTabBar() in '%s'\n", window->Name);
|
||||||
EndTabBar();
|
EndTabBar();
|
||||||
|
@ -2762,9 +2762,10 @@ struct ImGuiTabItem
|
|||||||
ImGuiTabItem() { memset(this, 0, sizeof(*this)); LastFrameVisible = LastFrameSelected = -1; RequestedWidth = -1.0f; NameOffset = -1; BeginOrder = IndexDuringLayout = -1; }
|
ImGuiTabItem() { memset(this, 0, sizeof(*this)); LastFrameVisible = LastFrameSelected = -1; RequestedWidth = -1.0f; NameOffset = -1; BeginOrder = IndexDuringLayout = -1; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Storage for a tab bar (sizeof() 152 bytes)
|
// Storage for a tab bar (sizeof() 160 bytes)
|
||||||
struct IMGUI_API ImGuiTabBar
|
struct IMGUI_API ImGuiTabBar
|
||||||
{
|
{
|
||||||
|
ImGuiWindow* Window;
|
||||||
ImVector<ImGuiTabItem> Tabs;
|
ImVector<ImGuiTabItem> Tabs;
|
||||||
ImGuiTabBarFlags Flags;
|
ImGuiTabBarFlags Flags;
|
||||||
ImGuiID ID; // Zero for tab-bars used by docking
|
ImGuiID ID; // Zero for tab-bars used by docking
|
||||||
|
@ -9146,6 +9146,7 @@ bool ImGui::BeginTabBarEx(ImGuiTabBar* tab_bar, const ImRect& tab_bar_bb, ImG
|
|||||||
// Add to stack
|
// Add to stack
|
||||||
g.CurrentTabBarStack.push_back(GetTabBarRefFromTabBar(tab_bar));
|
g.CurrentTabBarStack.push_back(GetTabBarRefFromTabBar(tab_bar));
|
||||||
g.CurrentTabBar = tab_bar;
|
g.CurrentTabBar = tab_bar;
|
||||||
|
tab_bar->Window = window;
|
||||||
|
|
||||||
// Append with multiple BeginTabBar()/EndTabBar() pairs.
|
// Append with multiple BeginTabBar()/EndTabBar() pairs.
|
||||||
tab_bar->BackupCursorPos = window->DC.CursorPos;
|
tab_bar->BackupCursorPos = window->DC.CursorPos;
|
||||||
|
Loading…
Reference in New Issue
Block a user