You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-14 13:41:12 +00:00
Mono: Fix crash when re-using script binding after domain reloading
This commit is contained in:
@@ -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) {
|
void CSharpLanguage::set_language_index(int p_idx) {
|
||||||
|
|
||||||
ERR_FAIL_COND(lang_idx != -1);
|
ERR_FAIL_COND(lang_idx != -1);
|
||||||
|
|||||||
@@ -309,6 +309,9 @@ class CSharpLanguage : public ScriptLanguage {
|
|||||||
|
|
||||||
Dictionary scripts_metadata;
|
Dictionary scripts_metadata;
|
||||||
|
|
||||||
|
friend class GDMono;
|
||||||
|
void _uninitialize_script_bindings();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StringNameCache string_names;
|
StringNameCache string_names;
|
||||||
|
|
||||||
|
|||||||
@@ -848,6 +848,8 @@ Error GDMono::reload_scripts_domain() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CSharpLanguage::get_singleton()->_uninitialize_script_bindings();
|
||||||
|
|
||||||
Error err = _load_scripts_domain();
|
Error err = _load_scripts_domain();
|
||||||
if (err != OK) {
|
if (err != OK) {
|
||||||
ERR_PRINT("Mono: Failed to load scripts domain");
|
ERR_PRINT("Mono: Failed to load scripts domain");
|
||||||
|
|||||||
Reference in New Issue
Block a user