| 9203 | } |
| 9204 | |
| 9205 | static void ImGui::ErrorCheckEndFrameSanityChecks() |
| 9206 | { |
| 9207 | ImGuiContext& g = *GImGui; |
| 9208 | |
| 9209 | // Verify that io.KeyXXX fields haven't been tampered with. Key mods should not be modified between NewFrame() and EndFrame() |
| 9210 | // One possible reason leading to this assert is that your backends update inputs _AFTER_ NewFrame(). |
| 9211 | // It is known that when some modal native windows called mid-frame takes focus away, some backends such as GLFW will |
| 9212 | // send key release events mid-frame. This would normally trigger this assertion and lead to sheared inputs. |
| 9213 | // We silently accommodate for this case by ignoring the case where all io.KeyXXX modifiers were released (aka key_mod_flags == 0), |
| 9214 | // while still correctly asserting on mid-frame key press events. |
| 9215 | const ImGuiKeyChord key_mods = GetMergedModsFromKeys(); |
| 9216 | IM_ASSERT((key_mods == 0 || g.IO.KeyMods == key_mods) && "Mismatching io.KeyCtrl/io.KeyShift/io.KeyAlt/io.KeySuper vs io.KeyMods"); |
| 9217 | IM_UNUSED(key_mods); |
| 9218 | |
| 9219 | // [EXPERIMENTAL] Recover from errors: You may call this yourself before EndFrame(). |
| 9220 | //ErrorCheckEndFrameRecover(); |
| 9221 | |
| 9222 | // Report when there is a mismatch of Begin/BeginChild vs End/EndChild calls. Important: Remember that the Begin/BeginChild API requires you |
| 9223 | // to always call End/EndChild even if Begin/BeginChild returns false! (this is unfortunately inconsistent with most other Begin* API). |
| 9224 | if (g.CurrentWindowStack.Size != 1) |
| 9225 | { |
| 9226 | if (g.CurrentWindowStack.Size > 1) |
| 9227 | { |
| 9228 | ImGuiWindow* window = g.CurrentWindowStack.back().Window; // <-- This window was not Ended! |
| 9229 | IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you forget to call End/EndChild?"); |
| 9230 | IM_UNUSED(window); |
| 9231 | while (g.CurrentWindowStack.Size > 1) |
| 9232 | End(); |
| 9233 | } |
| 9234 | else |
| 9235 | { |
| 9236 | IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you call End/EndChild too much?"); |
| 9237 | } |
| 9238 | } |
| 9239 | |
| 9240 | IM_ASSERT_USER_ERROR(g.GroupStack.Size == 0, "Missing EndGroup call!"); |
| 9241 | } |
| 9242 | |
| 9243 | // Experimental recovery from incorrect usage of BeginXXX/EndXXX/PushXXX/PopXXX calls. |
| 9244 | // Must be called during or before EndFrame(). |
nothing calls this directly
no test coverage detected