diff options
author | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2017-10-05 00:12:36 +0200 |
---|---|---|
committer | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2017-10-05 00:12:36 +0200 |
commit | 1d309439cbdaa21a75731bd8db28217690e829a2 (patch) | |
tree | b3452ac813bf389ec5e4f6edb2ee234732188e76 /modules/mono/mono_gd | |
parent | df22bbd7ede088293d92e3c9c30da1fd4c26dccc (diff) |
Uninitialized local and domain finalize fixes
- Make sure to run the GC before and after finalizing the scripts domain.
Diffstat (limited to 'modules/mono/mono_gd')
-rw-r--r-- | modules/mono/mono_gd/gd_mono.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp index 77f01842bb..d0b5b12d4b 100644 --- a/modules/mono/mono_gd/gd_mono.cpp +++ b/modules/mono/mono_gd/gd_mono.cpp @@ -31,6 +31,7 @@ #include <mono/metadata/mono-config.h> #include <mono/metadata/mono-debug.h> +#include <mono/metadata/mono-gc.h> #include "os/dir_access.h" #include "os/file_access.h" @@ -272,7 +273,7 @@ bool GDMono::_load_assembly(const String &p_name, GDMonoAssembly **r_assembly) { if (OS::get_singleton()->is_stdout_verbose()) OS::get_singleton()->print((String() + "Mono: Loading assembly " + p_name + "...\n").utf8()); - MonoImageOpenStatus status; + MonoImageOpenStatus status = MONO_IMAGE_OK; MonoAssemblyName *aname = mono_assembly_name_new(p_name.utf8()); MonoAssembly *assembly = mono_assembly_load_full(aname, NULL, &status, false); mono_assembly_name_free(aname); @@ -438,10 +439,14 @@ Error GDMono::_unload_scripts_domain() { if (mono_domain_get() != root_domain) mono_domain_set(root_domain, true); + mono_gc_collect(mono_gc_max_generation()); + finalizing_scripts_domain = true; mono_domain_finalize(scripts_domain, 2000); finalizing_scripts_domain = false; + mono_gc_collect(mono_gc_max_generation()); + _domain_assemblies_cleanup(mono_domain_get_id(scripts_domain)); api_assembly = NULL; |