summaryrefslogtreecommitdiff
path: root/modules/mono/csharp_script.h
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mono/csharp_script.h')
-rw-r--r--modules/mono/csharp_script.h36
1 files changed, 26 insertions, 10 deletions
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index fc604df2a0..501e0d9d6d 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -82,6 +82,21 @@ class CSharpScript : public Script {
Set<Object *> instances;
+#ifdef DEBUG_ENABLED
+ Set<ObjectID> 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<Pair<StringName, Variant> > properties;
+ };
+
+#ifdef TOOLS_ENABLED
+ Map<ObjectID, CSharpScript::StateBackup> 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<ObjectID, List<Pair<StringName, Variant> > > pending_reload_state;
-#endif
-
Map<StringName, PropertyInfo> member_info;
void _clear();
@@ -158,6 +169,8 @@ public:
virtual void update_exports();
virtual bool is_tool() const { return tool; }
+ virtual bool is_valid() const { return valid; }
+
virtual Ref<Script> get_base_script() const;
virtual ScriptLanguage *get_language() const;
@@ -184,6 +197,8 @@ class CSharpInstance : public ScriptInstance {
bool base_ref;
bool ref_dying;
bool unsafe_referenced;
+ bool predelete_notified;
+ bool destructing_script_instance;
Ref<CSharpScript> script;
Ref<MonoGCHandle> gchandle;
@@ -204,6 +219,8 @@ class CSharpInstance : public ScriptInstance {
public:
MonoObject *get_mono_object() const;
+ _FORCE_INLINE_ bool is_destructing_script_instance() { return destructing_script_instance; }
+
virtual bool set(const StringName &p_name, const Variant &p_value);
virtual bool get(const StringName &p_name, Variant &r_ret) const;
virtual void get_property_list(List<PropertyInfo> *p_properties) const;
@@ -253,11 +270,9 @@ class CSharpLanguage : public ScriptLanguage {
GDMono *gdmono;
SelfList<CSharpScript>::List script_list;
- Mutex *lock;
- Mutex *script_bind_lock;
- Mutex *script_gchandle_release_lock;
-
- Map<Ref<CSharpScript>, Map<ObjectID, List<Pair<StringName, Variant> > > > to_reload;
+ Mutex *script_instances_mutex;
+ Mutex *script_gchandle_release_mutex;
+ Mutex *language_bind_mutex;
Map<Object *, CSharpScriptBinding> script_bindings;
@@ -294,7 +309,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();