diff options
author | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2017-12-31 22:37:57 +0100 |
---|---|---|
committer | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2018-01-01 03:05:13 +0100 |
commit | b271aa48e4e0af3d9abb998ac9c03eae3b65825a (patch) | |
tree | bfb6702c16a72a476d7969283e8f8e51da9470fd /modules/mono/glue | |
parent | e350a56efd8d307a989414b474960468a67550d1 (diff) |
Mono: Script lifetime fixes
- alloc_language_binding: Use strong GC handle as well for references. Fixes #15138
- Set the native instance field of Godot.Object to IntPtr.Zero when it's freed.
- Create weak handles without tracking resurrection (that was causing trouble). This means we have to call notification predelete before queueing a native Object for deletion, and use the MonoObject* passed by the finalizer because the weak GC handle target will return NULL at this point.
Diffstat (limited to 'modules/mono/glue')
-rw-r--r-- | modules/mono/glue/glue_header.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/mono/glue/glue_header.h b/modules/mono/glue/glue_header.h index 75a4eb2b40..5e41da299b 100644 --- a/modules/mono/glue/glue_header.h +++ b/modules/mono/glue/glue_header.h @@ -53,9 +53,11 @@ } \ Object *m_instance = ci->creation_func(); -void godot_icall_Object_Dtor(Object *ptr) { - ERR_FAIL_NULL(ptr); - _GodotSharp::get_singleton()->queue_dispose(ptr); +void godot_icall_Object_Dtor(MonoObject *obj, Object *ptr) { +#ifdef DEBUG_ENABLED + CRASH_COND(ptr == NULL); +#endif + _GodotSharp::get_singleton()->queue_dispose(obj, ptr); } // -- ClassDB -- |