diff options
author | Ignacio Etcheverry <neikeq@users.noreply.github.com> | 2017-11-01 01:56:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-01 01:56:16 +0100 |
commit | 3c97a9543d7c7abdecb3804a780da7105f2b2886 (patch) | |
tree | d88b080fccf8d90bca23eca992a464502c67caac /modules/mono/csharp_script.cpp | |
parent | cb3ef3c7e678af78b7cf24dfb780617938a74d42 (diff) | |
parent | a018cbaee1130c34a84557a1a9fdf5186ee99fd1 (diff) | |
download | redot-engine-3c97a9543d7c7abdecb3804a780da7105f2b2886.tar.gz |
Merge pull request #12549 from neikeq/seriously-do-they
Mono cleanup fixes
Diffstat (limited to 'modules/mono/csharp_script.cpp')
-rw-r--r-- | modules/mono/csharp_script.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 86e4be1882..161e130a07 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -122,6 +122,9 @@ void CSharpLanguage::init() { void CSharpLanguage::finish() { + // Release gchandle bindings before finalizing mono runtime + gchandle_bindings.clear(); + if (gdmono) { memdelete(gdmono); gdmono = NULL; @@ -827,6 +830,14 @@ void *CSharpLanguage::alloc_instance_binding_data(Object *p_object) { void CSharpLanguage::free_instance_binding_data(void *p_data) { + if (GDMono::get_singleton() == NULL) { +#ifdef DEBUG_ENABLED + CRASH_COND(!gchandle_bindings.empty()); +#endif + // Mono runtime finalized, all the gchandle bindings were already released + return; + } + #ifndef NO_THREADS script_bind_lock->lock(); #endif |