Mono: Fix crash when re-using script binding after domain reloading

This commit is contained in:
Ignacio Etcheverry 2019-03-07 19:55:40 +01:00
parent 5f079e2ef9
commit e904f814c8
3 changed files with 12 additions and 0 deletions

View File

@ -985,6 +985,13 @@ bool CSharpLanguage::debug_break(const String &p_error, bool p_allow_continue) {
}
}
void CSharpLanguage::_uninitialize_script_bindings() {
for (Map<Object *, CSharpScriptBinding>::Element *E = script_bindings.front(); E; E = E->next()) {
CSharpScriptBinding &script_binding = E->value();
script_binding.inited = false;
}
}
void CSharpLanguage::set_language_index(int p_idx) {
ERR_FAIL_COND(lang_idx != -1);

View File

@ -309,6 +309,9 @@ class CSharpLanguage : public ScriptLanguage {
Dictionary scripts_metadata;
friend class GDMono;
void _uninitialize_script_bindings();
public:
StringNameCache string_names;

View File

@ -848,6 +848,8 @@ Error GDMono::reload_scripts_domain() {
}
}
CSharpLanguage::get_singleton()->_uninitialize_script_bindings();
Error err = _load_scripts_domain();
if (err != OK) {
ERR_PRINT("Mono: Failed to load scripts domain");