diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2018-01-01 11:46:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-01 11:46:14 +0100 |
commit | defdb5761d20739a0a469507d55fa75e06aa26c3 (patch) | |
tree | f651ab5501dd2e7df8ae3a1edc2762df6e51ffd6 /modules/mono/mono_gd/gd_mono.cpp | |
parent | d6a1125254787681b6373e449c93d8ce15811a69 (diff) | |
parent | fe391393d4f907f110875e6571d6ba20a102ddee (diff) |
Merge pull request #15232 from neikeq/issue-15138-and-more
Mono fixes
Diffstat (limited to 'modules/mono/mono_gd/gd_mono.cpp')
-rw-r--r-- | modules/mono/mono_gd/gd_mono.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp index c997b0f000..08059c9ba9 100644 --- a/modules/mono/mono_gd/gd_mono.cpp +++ b/modules/mono/mono_gd/gd_mono.cpp @@ -703,7 +703,7 @@ bool _GodotSharp::is_domain_loaded() { call_deferred("_dispose_callback"); \ } -void _GodotSharp::queue_dispose(Object *p_object) { +void _GodotSharp::queue_dispose(MonoObject *p_mono_object, Object *p_object) { if (GDMonoUtils::is_main_thread() && !GDMono::get_singleton()->is_finalizing_scripts_domain()) { _dispose_object(p_object); @@ -712,6 +712,13 @@ void _GodotSharp::queue_dispose(Object *p_object) { queue_mutex->lock(); #endif + // This is our last chance to invoke notification predelete (this is being called from the finalizer) + // We must use the MonoObject* passed by the finalizer, because the weak GC handle target returns NULL at this point + CSharpInstance *si = CAST_CSHARP_INSTANCE(p_object->get_script_instance()); + if (si) { + si->call_notification_no_check(p_mono_object, Object::NOTIFICATION_PREDELETE); + } + ENQUEUE_FOR_DISPOSAL(obj_delete_queue, p_object); #ifndef NO_THREADS |