Chosen name "Try to recover" over e.g. "Restore" to suggest this is not a 100% guaranteed recovery. Called by e.g. EndFrame() but may be called for manual recovery. Attempt to recover full window stack.
| 11018 | // Called by e.g. EndFrame() but may be called for manual recovery. |
| 11019 | // Attempt to recover full window stack. |
| 11020 | void ImGui::ErrorRecoveryTryToRecoverState(const ImGuiErrorRecoveryState* state_in) |
| 11021 | { |
| 11022 | // PVS-Studio V1044 is "Loop break conditions do not depend on the number of iterations" |
| 11023 | ImGuiContext& g = *GImGui; |
| 11024 | while (g.CurrentWindowStack.Size > state_in->SizeOfWindowStack) //-V1044 |
| 11025 | { |
| 11026 | // Recap: |
| 11027 | // - Begin()/BeginChild() return false to indicate the window is collapsed or fully clipped. |
| 11028 | // - Always call a matching End() for each Begin() call, regardless of its return value! |
| 11029 | // - Begin/End and BeginChild/EndChild logic is KNOWN TO BE INCONSISTENT WITH ALL OTHER BEGIN/END FUNCTIONS. |
| 11030 | // - We will fix that in a future major update. |
| 11031 | ImGuiWindow* window = g.CurrentWindow; |
| 11032 | if (window->Flags & ImGuiWindowFlags_ChildWindow) |
| 11033 | { |
| 11034 | if (g.CurrentTable != NULL && g.CurrentTable->InnerWindow == g.CurrentWindow) |
| 11035 | { |
| 11036 | IM_ASSERT_USER_ERROR(0, "Missing EndTable()"); |
| 11037 | EndTable(); |
| 11038 | } |
| 11039 | else |
| 11040 | { |
| 11041 | IM_ASSERT_USER_ERROR(0, "Missing EndChild()"); |
| 11042 | EndChild(); |
| 11043 | } |
| 11044 | } |
| 11045 | else |
| 11046 | { |
| 11047 | IM_ASSERT_USER_ERROR(0, "Missing End()"); |
| 11048 | End(); |
| 11049 | } |
| 11050 | } |
| 11051 | if (g.CurrentWindowStack.Size == state_in->SizeOfWindowStack) |
| 11052 | ErrorRecoveryTryToRecoverWindowState(state_in); |
| 11053 | } |
| 11054 | |
| 11055 | // Called by e.g. End() but may be called for manual recovery. |
| 11056 | // Read '// Error Handling [BETA]' block in imgui_internal.h for details. |
nothing calls this directly
no outgoing calls
no test coverage detected