mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-24 00:26:36 +00:00
Error recovery: Extraneous/undesired calls to End() are now being caught by an assert in the End() function itself at the call site (instead of being reported in EndFrame). Past the assert, they don't lead to crashes any more. Missing calls to End(), pass the assert, should not lead to crashes any more, nor to the fallback/debug window appearing on screen. (#1651).
This commit is contained in:
parent
a9a60a24c1
commit
d845135273
@ -62,6 +62,10 @@ Other Changes:
|
||||
This affects clamping window within the visible area: with this option enabled title bars need to be visible. (#899)
|
||||
- Window: Fixed using SetNextWindowPos() on a child window (which wasn't really documented) position the cursor as expected
|
||||
in the parent window, so there is no mismatch between the layout in parent and the position of the child window.
|
||||
- Error recovery: Extraneous/undesired calls to End() are now being caught by an assert in the End() function itself
|
||||
at the call site (instead of being reported in EndFrame). Past the assert, they don't lead to crashes any more. (#1651)
|
||||
- Error recovery: Missing calls to End(), pass the assert, should not lead to crashes or to the fallback Debug window
|
||||
appearing on screen, (#1651).
|
||||
- IO: Added BackendPlatformUserData, BackendRendererUserData, BackendLanguageUserData void* for storage use by back-ends.
|
||||
- Style: Tweaked default value of style.DisplayWindowPadding from (20,20) to (19,19) so the default style as a value
|
||||
which is the same as the title bar height.
|
||||
|
19
imgui.cpp
19
imgui.cpp
@ -3555,6 +3555,9 @@ void ImGui::EndFrame()
|
||||
return;
|
||||
IM_ASSERT(g.FrameScopeActive && "Forgot to call ImGui::NewFrame()?");
|
||||
|
||||
g.FrameScopeActive = false;
|
||||
g.FrameCountEnded = g.FrameCount;
|
||||
|
||||
// Notify OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME)
|
||||
if (g.IO.ImeSetInputScreenPosFn && ImLengthSqr(g.PlatformImeLastPos - g.PlatformImePos) > 0.0001f)
|
||||
{
|
||||
@ -3567,9 +3570,15 @@ void ImGui::EndFrame()
|
||||
if (g.CurrentWindowStack.Size != 1)
|
||||
{
|
||||
if (g.CurrentWindowStack.Size > 1)
|
||||
{
|
||||
IM_ASSERT(g.CurrentWindowStack.Size == 1 && "Mismatched Begin/BeginChild vs End/EndChild calls: did you forget to call End/EndChild?");
|
||||
while (g.CurrentWindowStack.Size > 1) // FIXME-ERRORHANDLING
|
||||
End();
|
||||
}
|
||||
else
|
||||
{
|
||||
IM_ASSERT(g.CurrentWindowStack.Size == 1 && "Mismatched Begin/BeginChild vs End/EndChild calls: did you call End/EndChild too much?");
|
||||
}
|
||||
}
|
||||
|
||||
// Hide implicit/fallback "Debug" window if it hasn't been used
|
||||
@ -3665,9 +3674,6 @@ void ImGui::EndFrame()
|
||||
g.IO.MouseWheel = g.IO.MouseWheelH = 0.0f;
|
||||
memset(g.IO.InputCharacters, 0, sizeof(g.IO.InputCharacters));
|
||||
memset(g.IO.NavInputs, 0, sizeof(g.IO.NavInputs));
|
||||
|
||||
g.FrameScopeActive = false;
|
||||
g.FrameCountEnded = g.FrameCount;
|
||||
}
|
||||
|
||||
void ImGui::Render()
|
||||
@ -5251,6 +5257,13 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_first_use,
|
||||
void ImGui::End()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
||||
if (g.CurrentWindowStack.Size <= 1 && g.FrameScopeActive)
|
||||
{
|
||||
IM_ASSERT(g.CurrentWindowStack.Size > 1 && "Calling End() too many times!");
|
||||
return; // FIXME-ERRORHANDLING
|
||||
}
|
||||
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
|
||||
if (window->DC.ColumnsSet != NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user