You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Merge pull request #101006 from zaevi/fix_csharp_refcounted_dispose
C#: Fix `RefCounted` not disposed correctly in certain case
This commit is contained in:
@@ -203,6 +203,11 @@ void godotsharp_internal_refcounted_disposed(Object *p_ptr, GCHandleIntPtr p_gch
|
||||
CSharpScriptBinding &script_binding = ((RBMap<Object *, CSharpScriptBinding>::Element *)data)->get();
|
||||
if (script_binding.inited) {
|
||||
if (!script_binding.gchandle.is_released()) {
|
||||
if (rc->get_reference_count() == 1 && script_binding.gchandle.is_weak()) {
|
||||
// The GCHandle is just swapped, so get the swapped handle to release
|
||||
// See: CSharpLanguage::_instance_binding_reference_callback(void *p_token, void *p_binding, GDExtensionBool p_reference)
|
||||
p_gchandle_to_free = script_binding.gchandle.get_intptr();
|
||||
}
|
||||
CSharpLanguage::release_binding_gchandle_thread_safe(p_gchandle_to_free, script_binding);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user