-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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#: Check if .NET runtime has been finalized in the instance binding reference callback #77362
C#: Check if .NET runtime has been finalized in the instance binding reference callback #77362
Conversation
…reference callback
CC @raulsntos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not very familiar with the reference count system so take this review with a grain of salt. In general it makes sense to me that if the .NET runtime is finalized, the reference_callback
implementation would return true and let the object be freed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm preemptively blocking this from being merged before I review it tomorrow. But in advance I can say there's probably something wrong elsewhere as instance bindings should have been cleaned up before/after finalizing.
Yes, arguably the instance binding should have been detached from objects before godot/modules/mono/csharp_script.cpp Line 165 in f9fc77b
Edit: alternatively #78157 also fixes the crash by moving the |
The problem is indeed somewhere else. We cannot remove the script bindings, but that's what the |
Wait, I just realized we check |
When these issues occur I would use #78157 to fix the issue (It gracefully deletes the managed objects before dropping the instance bindings map) and then either keep this PR as-is as backup or just close this as superseded. |
If #78157 fixes the issue, then I think I'm leaning towards closing this PR as superseded. If, as you say, some bound objects survive after As I understand it from the previous conversation, the bound objects should have been cleared before reaching |
This comment was marked as duplicate.
This comment was marked as duplicate.
Superseded by #78157 |
Fixes #77305
Turns out you can't detach an instance binding from an object, so duplicate a check from
_instance_binding_free_callback
.