MCPcopy Create free account
hub / github.com/Wemino/EchoPatch / ErrorRecoveryTryToRecoverState

Method ErrorRecoveryTryToRecoverState

include/imgui/imgui.cpp:10944–10977  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

10942// Called by e.g. EndFrame() but may be called for manual recovery.
10943// Attempt to recover full window stack.
10944void ImGui::ErrorRecoveryTryToRecoverState(const ImGuiErrorRecoveryState* state_in)
10945{
10946 // PVS-Studio V1044 is "Loop break conditions do not depend on the number of iterations"
10947 ImGuiContext& g = *GImGui;
10948 while (g.CurrentWindowStack.Size > state_in->SizeOfWindowStack) //-V1044
10949 {
10950 // Recap:
10951 // - Begin()/BeginChild() return false to indicate the window is collapsed or fully clipped.
10952 // - Always call a matching End() for each Begin() call, regardless of its return value!
10953 // - Begin/End and BeginChild/EndChild logic is KNOWN TO BE INCONSISTENT WITH ALL OTHER BEGIN/END FUNCTIONS.
10954 // - We will fix that in a future major update.
10955 ImGuiWindow* window = g.CurrentWindow;
10956 if (window->Flags & ImGuiWindowFlags_ChildWindow)
10957 {
10958 if (g.CurrentTable != NULL && g.CurrentTable->InnerWindow == g.CurrentWindow)
10959 {
10960 IM_ASSERT_USER_ERROR(0, "Missing EndTable()");
10961 EndTable();
10962 }
10963 else
10964 {
10965 IM_ASSERT_USER_ERROR(0, "Missing EndChild()");
10966 EndChild();
10967 }
10968 }
10969 else
10970 {
10971 IM_ASSERT_USER_ERROR(0, "Missing End()");
10972 End();
10973 }
10974 }
10975 if (g.CurrentWindowStack.Size == state_in->SizeOfWindowStack)
10976 ErrorRecoveryTryToRecoverWindowState(state_in);
10977}
10978
10979// Called by e.g. End() but may be called for manual recovery.
10980// Read '// Error Handling [BETA]' block in imgui_internal.h for details.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected