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.
| 11646 | // Called by e.g. EndFrame() but may be called for manual recovery. |
| 11647 | // Attempt to recover full window stack. |
| 11648 | void ImGui::ErrorRecoveryTryToRecoverState(const ImGuiErrorRecoveryState* state_in) |
| 11649 | { |
| 11650 | // PVS-Studio V1044 is "Loop break conditions do not depend on the number of iterations" |
| 11651 | ImGuiContext& g = *GImGui; |
| 11652 | while (g.CurrentWindowStack.Size > state_in->SizeOfWindowStack) //-V1044 |
| 11653 | { |
| 11654 | // Recap: |
| 11655 | // - Begin()/BeginChild() return false to indicate the window is collapsed or fully clipped. |
| 11656 | // - Always call a matching End() for each Begin() call, regardless of its return value! |
| 11657 | // - Begin/End and BeginChild/EndChild logic is KNOWN TO BE INCONSISTENT WITH ALL OTHER BEGIN/END FUNCTIONS. |
| 11658 | // - We will fix that in a future major update. |
| 11659 | ImGuiWindow* window = g.CurrentWindow; |
| 11660 | if (window->Flags & ImGuiWindowFlags_ChildWindow) |
| 11661 | { |
| 11662 | if (g.CurrentTable != NULL && g.CurrentTable->InnerWindow == g.CurrentWindow) |
| 11663 | { |
| 11664 | IM_ASSERT_USER_ERROR(0, "Missing EndTable()"); |
| 11665 | EndTable(); |
| 11666 | } |
| 11667 | else |
| 11668 | { |
| 11669 | IM_ASSERT_USER_ERROR(0, "Missing EndChild()"); |
| 11670 | EndChild(); |
| 11671 | } |
| 11672 | } |
| 11673 | else |
| 11674 | { |
| 11675 | IM_ASSERT_USER_ERROR(0, "Missing End()"); |
| 11676 | End(); |
| 11677 | } |
| 11678 | } |
| 11679 | if (g.CurrentWindowStack.Size == state_in->SizeOfWindowStack) |
| 11680 | ErrorRecoveryTryToRecoverWindowState(state_in); |
| 11681 | } |
| 11682 | |
| 11683 | // Called by e.g. End() but may be called for manual recovery. |
| 11684 | // Read '// Error Handling [BETA]' block in imgui_internal.h for details. |
nothing calls this directly
no outgoing calls
no test coverage detected