summaryrefslogtreecommitdiffstats
path: root/modules/mono/mono_gd/gd_mono_internals.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mono/mono_gd/gd_mono_internals.cpp')
-rw-r--r--modules/mono/mono_gd/gd_mono_internals.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/modules/mono/mono_gd/gd_mono_internals.cpp b/modules/mono/mono_gd/gd_mono_internals.cpp
index cb28efb4e5..a84332d4cd 100644
--- a/modules/mono/mono_gd/gd_mono_internals.cpp
+++ b/modules/mono/mono_gd/gd_mono_internals.cpp
@@ -74,15 +74,14 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) {
script_binding.type_name = NATIVE_GDMONOCLASS_NAME(klass);
script_binding.wrapper_class = klass;
script_binding.gchandle = MonoGCHandle::create_strong(managed);
+ script_binding.owner = unmanaged;
- Reference *kref = Object::cast_to<Reference>(unmanaged);
- if (kref) {
+ if (ref) {
// Unsafe refcount increment. The managed instance also counts as a reference.
// This way if the unmanaged world has no references to our owner
// but the managed instance is alive, the refcount will be 1 instead of 0.
// See: godot_icall_Reference_Dtor(MonoObject *p_obj, Object *p_ptr)
-
- kref->reference();
+ ref->reference();
}
// The object was just created, no script instance binding should have been attached