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

Windows: Fix crash on application exit due to not unregistered callbacks #37549

Closed
wants to merge 1 commit into from

Conversation

HaSa1002
Copy link
Contributor

@HaSa1002 HaSa1002 commented Apr 3, 2020

fixes #37548

@HaSa1002 HaSa1002 changed the title fixed crash on application exit due to undestructed windows fixed crash on application exit due to not unregistered callbacks Apr 3, 2020
@akien-mga akien-mga requested a review from reduz April 3, 2020 11:25
@akien-mga akien-mga added this to the 4.0 milestone Apr 3, 2020
@reduz
Copy link
Member

reduz commented Apr 3, 2020

the problem here is that by the point the code reaches the destructor, there should not be any window left. If there is one, it's a bug.

@HaSa1002
Copy link
Contributor Author

HaSa1002 commented Apr 3, 2020

Why is there a window with the id of -1 in it? Is that correct because of base nil or because my vs is troubling or shouldn't it be there?

@HaSa1002
Copy link
Contributor Author

HaSa1002 commented Apr 3, 2020

Found it. The _nil window is with callbacks registered. Where and why?

@HaSa1002
Copy link
Contributor Author

HaSa1002 commented Apr 3, 2020

Is it wanted, that the window_id_counter is only increased and never decreased? It's only an int...

@HaSa1002
Copy link
Contributor Author

HaSa1002 commented Apr 3, 2020

Okay I think the error is actually caused by the main window itself. When you close the window and unfocus it quick enough (reproducable, but you may need a few attemps), then the unfocus event is still sent to Godot while it is shutting down. This last event is sent to the callback function of the then freed window. I tested with my new fix and I couldn't manage to crash Godot again.

@HaSa1002 HaSa1002 requested a review from akien-mga April 3, 2020 14:44
@akien-mga akien-mga changed the title fixed crash on application exit due to not unregistered callbacks WIndows: fixed crash on application exit due to not unregistered callbacks Apr 10, 2020
@akien-mga akien-mga changed the title WIndows: fixed crash on application exit due to not unregistered callbacks Windows: fixed crash on application exit due to not unregistered callbacks Apr 10, 2020
@HaSa1002 HaSa1002 force-pushed the fix-win-crash-on-exit branch 2 times, most recently from b2214c5 to 6bfd1e9 Compare April 29, 2020 13:27
@HaSa1002
Copy link
Contributor Author

#37382 (comment)
Should fix that issue, too, because currently the wndproc writes into the invalid window and might call stuff in it

@HaSa1002 HaSa1002 changed the title Windows: fixed crash on application exit due to not unregistered callbacks Windows: Fix crash on application exit due to not unregistered callbacks May 16, 2020
@HaSa1002
Copy link
Contributor Author

Was fixed along the way

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.

Editor crash on exit due to not unregistered callbacks
3 participants