From b9b7dcdf001e1705ec45deab56d31eb74dcaaa4d Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Fri, 30 Nov 2018 20:43:06 +0100 Subject: C#: Improve tool script support and fix reloading issues --- modules/mono/csharp_script.h | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'modules/mono/csharp_script.h') diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h index fc604df2a0..355a09cd89 100644 --- a/modules/mono/csharp_script.h +++ b/modules/mono/csharp_script.h @@ -82,6 +82,21 @@ class CSharpScript : public Script { Set instances; +#ifdef DEBUG_ENABLED + Set pending_reload_instances; +#endif + + struct StateBackup { + // TODO + // Replace with buffer containing the serialized state of managed scripts. + // Keep variant state backup to use only with script instance placeholders. + List > properties; + }; + +#ifdef TOOLS_ENABLED + Map pending_reload_state; +#endif + String source; StringName name; @@ -105,10 +120,6 @@ class CSharpScript : public Script { virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder); #endif -#ifdef DEBUG_ENABLED - Map > > pending_reload_state; -#endif - Map member_info; void _clear(); @@ -184,6 +195,7 @@ class CSharpInstance : public ScriptInstance { bool base_ref; bool ref_dying; bool unsafe_referenced; + bool predelete_notified; Ref script; Ref gchandle; @@ -253,11 +265,9 @@ class CSharpLanguage : public ScriptLanguage { GDMono *gdmono; SelfList::List script_list; - Mutex *lock; - Mutex *script_bind_lock; - Mutex *script_gchandle_release_lock; - - Map, Map > > > to_reload; + Mutex *script_instances_mutex; + Mutex *script_gchandle_release_mutex; + Mutex *language_bind_mutex; Map script_bindings; @@ -294,7 +304,8 @@ public: bool debug_break_parse(const String &p_file, int p_line, const String &p_error); #ifdef TOOLS_ENABLED - void reload_assemblies_if_needed(bool p_soft_reload); + bool is_assembly_reloading_needed(); + void reload_assemblies(bool p_soft_reload); #endif void project_assembly_loaded(); -- cgit v1.2.3