Skip to content
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

Fix crash on Windows when closing Window #80142

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

Sauermann
Copy link
Contributor

resolve #80134
regression from #67791
conflict with #73239

  1. Send WINDOW_EVENT_MOUSE_EXIT when a window is destroyed.

This fix had been included in #67791 for some time to fix comment #67791 (comment), but unfortunately (I apologize) got lost because I have developed the PR on two different computers.
This fix alone however no longer works in current master, because it conflicts with #73239.

  1. Ensure, that on Windows, the event_callback is still valid during destroying the Window.

#73239 cleared the event_callback before calling DisplayServer::delete_sub_window.
However on Windows it becomes necessary, that this callback is still valid while the Window is destroyed.

#73239 had the goal of closing issue #72707, which is linuxbsd-specific.
In this PR I move the changes of #73239 from Window to DisplayServerX11, so that on linuxbsd #72707 should not be reintroduced. I can't test #72707, because I don't have the specific Window-manager i3wm installed. @bruvzg Since that PR was from you, may I ask you, if you consider this change valid?

Send `WINDOW_EVENT_MOUSE_EXIT` when a window is destroyed.

Ensure, that on Windows, the event_callback is still valid during
destroying the `Window`.
@akien-mga akien-mga merged commit 933281f into godotengine:master Aug 2, 2023
13 checks passed
@akien-mga
Copy link
Member

Thanks!

@Sauermann Sauermann deleted the fix-window-close-crash branch August 2, 2023 16:05
@bruvzg
Copy link
Member

bruvzg commented Aug 3, 2023

The same crash is also present on macOS, I expect it's the case on X11 as well. Neither is sending mouse leave event on window destruction or tracking last window with the mouse and only forwarding Mouse Enter/Leave system events.

@Sauermann
Copy link
Contributor Author

I was unable to replicate the crash on X11.
Regarding MacOS, the crash should be mitigated by #80187.

@Sauermann
Copy link
Contributor Author

@bruvzg you were right, that the crash happens also on X11: #79325 (comment)
A way to fixing this crash on the platform-display-server-side is available for X11 in #80279

@Summersay415
Copy link
Contributor

Summersay415 commented May 28, 2024

This PR causes double 'close_requested' emission on Window with 'popup_window' enabled, but only on Linux/*BSD. Issue: #92417

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Random crashes from Window::_event_callback
4 participants