MCPcopy Create free account
hub / github.com/Raais/ImStudio / ErrorCheckEndFrameSanityChecks

Method ErrorCheckEndFrameSanityChecks

src/third-party/imgui/imgui.cpp:7961–7995  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7959}
7960
7961static void ImGui::ErrorCheckEndFrameSanityChecks()
7962{
7963 ImGuiContext& g = *GImGui;
7964
7965 // Verify that io.KeyXXX fields haven't been tampered with. Key mods should not be modified between NewFrame() and EndFrame()
7966 // One possible reason leading to this assert is that your backends update inputs _AFTER_ NewFrame().
7967 // It is known that when some modal native windows called mid-frame takes focus away, some backends such as GLFW will
7968 // send key release events mid-frame. This would normally trigger this assertion and lead to sheared inputs.
7969 // We silently accommodate for this case by ignoring/ the case where all io.KeyXXX modifiers were released (aka key_mod_flags == 0),
7970 // while still correctly asserting on mid-frame key press events.
7971 const ImGuiKeyModFlags key_mod_flags = GetMergedKeyModFlags();
7972 IM_ASSERT((key_mod_flags == 0 || g.IO.KeyMods == key_mod_flags) && "Mismatching io.KeyCtrl/io.KeyShift/io.KeyAlt/io.KeySuper vs io.KeyMods");
7973 IM_UNUSED(key_mod_flags);
7974
7975 // Recover from errors
7976 //ErrorCheckEndFrameRecover();
7977
7978 // Report when there is a mismatch of Begin/BeginChild vs End/EndChild calls. Important: Remember that the Begin/BeginChild API requires you
7979 // to always call End/EndChild even if Begin/BeginChild returns false! (this is unfortunately inconsistent with most other Begin* API).
7980 if (g.CurrentWindowStack.Size != 1)
7981 {
7982 if (g.CurrentWindowStack.Size > 1)
7983 {
7984 IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you forget to call End/EndChild?");
7985 while (g.CurrentWindowStack.Size > 1)
7986 End();
7987 }
7988 else
7989 {
7990 IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you call End/EndChild too much?");
7991 }
7992 }
7993
7994 IM_ASSERT_USER_ERROR(g.GroupStack.Size == 0, "Missing EndGroup call!");
7995}
7996
7997// Experimental recovery from incorrect usage of BeginXXX/EndXXX/PushXXX/PopXXX calls.
7998// Must be called during or before EndFrame().

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected