Experimental recovery from incorrect usage of BeginXXX/EndXXX/PushXXX/PopXXX calls. Must be called during or before EndFrame(). 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 interleaved BeginTabBar/Begin
| 8000 | // FIXME: Can't recover from inside BeginTabItem/EndTabItem yet. |
| 8001 | // FIXME: Can't recover from interleaved BeginTabBar/Begin |
| 8002 | void ImGui::ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data) |
| 8003 | { |
| 8004 | // PVS-Studio V1044 is "Loop break conditions do not depend on the number of iterations" |
| 8005 | ImGuiContext& g = *GImGui; |
| 8006 | while (g.CurrentWindowStack.Size > 0) //-V1044 |
| 8007 | { |
| 8008 | ErrorCheckEndWindowRecover(log_callback, user_data); |
| 8009 | ImGuiWindow* window = g.CurrentWindow; |
| 8010 | if (g.CurrentWindowStack.Size == 1) |
| 8011 | { |
| 8012 | IM_ASSERT(window->IsFallbackWindow); |
| 8013 | break; |
| 8014 | } |
| 8015 | IM_ASSERT(window == g.CurrentWindow); |
| 8016 | if (window->Flags & ImGuiWindowFlags_ChildWindow) |
| 8017 | { |
| 8018 | if (log_callback) log_callback(user_data, "Recovered from missing EndChild() for '%s'", window->Name); |
| 8019 | EndChild(); |
| 8020 | } |
| 8021 | else |
| 8022 | { |
| 8023 | if (log_callback) log_callback(user_data, "Recovered from missing End() for '%s'", window->Name); |
| 8024 | End(); |
| 8025 | } |
| 8026 | } |
| 8027 | } |
| 8028 | |
| 8029 | // Must be called before End()/EndChild() |
| 8030 | void ImGui::ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, void* user_data) |
nothing calls this directly
no outgoing calls
no test coverage detected