diff options
| author | Ignacio Etcheverry | 2017-11-01 01:48:47 +0100 |
|---|---|---|
| committer | Ignacio Etcheverry | 2017-11-01 01:48:47 +0100 |
| commit | 06ea441564937d97b0931aecba771b60e077b1d5 (patch) | |
| tree | cd4f833c7b80d6d1ad8aa9c353dd25fc18508b07 /modules/mono/csharp_script.cpp | |
| parent | a4ea63737c9ed862c4a421d668942d6ffaf5a861 (diff) | |
| download | godot-06ea441564937d97b0931aecba771b60e077b1d5.tar.gz godot-06ea441564937d97b0931aecba771b60e077b1d5.tar.zst godot-06ea441564937d97b0931aecba771b60e077b1d5.zip | |
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 3d91a6de6..edb1434ad 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; @@ -794,6 +797,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 |
