-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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
C#: Clear instance bindings callbacks on finalizing the language #93172
C#: Clear instance bindings callbacks on finalizing the language #93172
Conversation
When finalizing the C# language every C# instance is disposed and the instance bindings callbacks are no longer valid. Clearing the instance bindings ensures these callbacks are not called, and since we dispose of every C# instance there should be no leaks.
I just saw this PR linked to an issue I reported. If it is still relevant to test this, I'll probably have time next week (unless there's breaking changes from projects using 4.2.2 I would have trouble quickly fixing meaning I couldn't easily test this). |
Testing is very much appreciated. It'd be great if you could confirm whether the PR fixes your issue. Regarding breaking changes from 4.2.2. Since this PR is based on 5833f59 which I believe is closest to 4.3-beta.3, you can use the Upgrading from Godot 4.2 to Godot 4.3 documentation page to see the list of breaking changes that you may have to deal with. |
This works! The Godot editor version I compiled from this branch no longer crashes on shutdown (just complains about the usual rendering server singleton null). Just to confirm I also compiled a version from latest master branch commit (3e0c10d) and did the exact same steps as in the other test, and that still crashes. So I can confirm that this PR seems to fix the crash I reported: #89941 I didn't do a really thorough test but nothing major was obviously wrong with my game with this PR so this doesn't break at least anything immediately obvious. I did notice that I'll have the task of fixing some icon sizing again with the Godot 4.3 release, but that's not related to the changes in this PR. |
I have tested this PR and fixes #95708, +1 to merge this ASAP please. 😃 |
Thanks! |
Great that you found and fixed the issue. |
@AlexanderLangguth This is a bit of a risky change so I'd rather wait until it gets more testing on 4.4 first, to ensure it doesn't introduce regressions (e.g.: memory leaks). Can you confirm that your CI issues are fixed with Godot 4.4-dev.1? |
When finalizing the C# language every C# instance is disposed and the instance bindings callbacks are no longer valid. Clearing the instance bindings ensures these callbacks are not called, and since we dispose of every C# instance there should be no leaks.
InputMap.ActionGetEvents
with StringName fromInputMap.GetActions
causes a crash in Godot 4.2.2 mono #89941.GetThemeStylebox
in C# #92076.