-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDL hangs all event processing on window move, causing ImGui to crash #57
Comments
Interesting. What's the platform / compiler you're on? Is it possible that the app is running at more than 60 FPS (indicating broken VSync, probably) which is causing the delta time to be very close to zero? |
Ah! Now I see -- you mean dragging the application window, not the ImGui windows, right? This could be because, IIRC, on Windows each window drag triggers a repaint for some reason, causing I'll need to investigate why this frequent redraw is done, if it's needed at all and how ImGui itself handles this in its own examples. Thanks for the report, I'll ping you back once I have something. |
Yes, I mean application window. Ok. Thanks. |
Unfortunately I don't really have a solution for this. SDL has a Window-specific bug/misfeature, reported back in 2014 and not fixed since, where it hangs all event processing for the time where you drag or resize the window. After that, it flushes the event queue, causing repaint events and everything else to happen immediately after each other. That ImGui crashes is only a consequence, it's very likely to cause serious misbehavior elsewhere as well -- I hit this most recently with mosra/magnum#423 when trying to implement DPI scaling change events, there it delays the window resize to when you release the mouse again, not nice. I am monitoring that bug, hoping something will happen in this decade at least. Two suggestions -- either don't drag windows with ImGui in it, or switch to GlfwApplication, GLFW doesn't suffer from this problem at all. |
Worked around in e7dc17a basically the same way you suggested -- there's nothing happening about this at on the SDL side at all (the bug is milestoned for SDL 2.1, who knows when that happens), so let's do a fix here instead. |
libsdl-org/SDL#1059 was fixed very recently in SDL 2.30. |
If you try to drag the window, the application will crash with an error: Expression: (g.IO.DeltaTime > 0.0f || g.FrameCount == 0) && "Need a positive DeltaTime!"
https://github.com/mosra/magnum-integration/blob/master/src/Magnum/ImGuiIntegration/Context.cpp#L252 io.DeltaTime can be zero.
Possible fix:
if (io.DeltaTime == 0.0f) { io.DeltaTime = 0.0000001f; }
but looks creepy
The text was updated successfully, but these errors were encountered: