You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Mono: Script lifetime fixes
- alloc_language_binding: Use strong GC handle as well for references. Fixes #15138 - Set the native instance field of Godot.Object to IntPtr.Zero when it's freed. - Create weak handles without tracking resurrection (that was causing trouble). This means we have to call notification predelete before queueing a native Object for deletion, and use the MonoObject* passed by the finalizer because the weak GC handle target will return NULL at this point.
This commit is contained in:
@@ -167,7 +167,7 @@ class CSharpInstance : public ScriptInstance {
|
||||
bool base_ref;
|
||||
bool ref_dying;
|
||||
|
||||
void _ml_call_reversed(GDMonoClass *klass, const StringName &p_method, const Variant **p_args, int p_argcount);
|
||||
void _ml_call_reversed(MonoObject *p_mono_object, GDMonoClass *klass, const StringName &p_method, const Variant **p_args, int p_argcount);
|
||||
|
||||
void _reference_owner_unsafe();
|
||||
void _unreference_owner_unsafe();
|
||||
@@ -176,6 +176,8 @@ class CSharpInstance : public ScriptInstance {
|
||||
friend void GDMonoInternals::tie_managed_to_unmanaged(MonoObject *, Object *);
|
||||
static CSharpInstance *create_for_managed_type(Object *p_owner, CSharpScript *p_script, const Ref<MonoGCHandle> &p_gchandle);
|
||||
|
||||
void _call_multilevel(MonoObject *p_mono_object, const StringName &p_method, const Variant **p_args, int p_argcount);
|
||||
|
||||
public:
|
||||
MonoObject *get_mono_object() const;
|
||||
|
||||
@@ -192,13 +194,14 @@ public:
|
||||
|
||||
void mono_object_disposed();
|
||||
|
||||
void refcount_incremented();
|
||||
bool refcount_decremented();
|
||||
virtual void refcount_incremented();
|
||||
virtual bool refcount_decremented();
|
||||
|
||||
RPCMode get_rpc_mode(const StringName &p_method) const;
|
||||
RPCMode get_rset_mode(const StringName &p_variable) const;
|
||||
virtual RPCMode get_rpc_mode(const StringName &p_method) const;
|
||||
virtual RPCMode get_rset_mode(const StringName &p_variable) const;
|
||||
|
||||
virtual void notification(int p_notification);
|
||||
void call_notification_no_check(MonoObject *p_mono_object, int p_notification);
|
||||
|
||||
virtual Ref<Script> get_script() const;
|
||||
|
||||
@@ -215,6 +218,8 @@ class CSharpLanguage : public ScriptLanguage {
|
||||
|
||||
static CSharpLanguage *singleton;
|
||||
|
||||
bool finalizing;
|
||||
|
||||
GDMono *gdmono;
|
||||
SelfList<CSharpScript>::List script_list;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user