From 8ce4a0cf1554f609b6a12f6bf136440aeb7e34bb Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Wed, 7 Feb 2024 06:33:51 +0100 Subject: [PATCH] C#: Fix crash when reloading scripts The crash cond was accidentally moved to the `reload_scripts` method when it was only meant to be in the `reload_tool_script` method. Same about restarting the HotReloadAssemblyWatcher timer. Also removed the loop that checks if the script array contains a C# script because if we're in CSharpLanguage we can assume that at least one of them is. --- modules/mono/csharp_script.cpp | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index a84febb226..18724ff6e1 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -727,21 +727,16 @@ void CSharpLanguage::reload_all_scripts() { } void CSharpLanguage::reload_scripts(const Array &p_scripts, bool p_soft_reload) { +#ifdef GD_MONO_HOT_RELOAD + if (is_assembly_reloading_needed()) { + reload_assemblies(p_soft_reload); + } +#endif +} + +void CSharpLanguage::reload_tool_script(const Ref