summaryrefslogtreecommitdiffstats
path: root/modules/mono/mono_gc_handle.h
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2018-09-12 02:41:54 +0200
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2018-09-12 03:24:08 +0200
commite558e1ec09aa27852426bbd24dfa21e9b60cfbfc (patch)
treef9a6b7391f7bf047526ab5cbac584b647a68227c /modules/mono/mono_gc_handle.h
parent61426464ea28f82f0c340572caafeb6aaaad4c91 (diff)
downloadredot-engine-e558e1ec09aa27852426bbd24dfa21e9b60cfbfc.tar.gz
Fix/workaround for issue #21667
When a Reference managed instance is garbage collected and its finalizer is called, it could happen that the native instance is referenced once again before the finalizer can unreference and memdelete it. The workaround is to create a new managed instance when this happens (at least for now).
Diffstat (limited to 'modules/mono/mono_gc_handle.h')
-rw-r--r--modules/mono/mono_gc_handle.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/mono/mono_gc_handle.h b/modules/mono/mono_gc_handle.h
index 7eeaba30e0..e145c1e1e6 100644
--- a/modules/mono/mono_gc_handle.h
+++ b/modules/mono/mono_gc_handle.h
@@ -49,12 +49,15 @@ public:
WEAK_HANDLE
};
- static uint32_t make_strong_handle(MonoObject *p_object);
- static uint32_t make_weak_handle(MonoObject *p_object);
+ static uint32_t new_strong_handle(MonoObject *p_object);
+ static uint32_t new_strong_handle_pinned(MonoObject *p_object);
+ static uint32_t new_weak_handle(MonoObject *p_object);
+ static void free_handle(uint32_t p_gchandle);
static Ref<MonoGCHandle> create_strong(MonoObject *p_object);
static Ref<MonoGCHandle> create_weak(MonoObject *p_object);
+ _FORCE_INLINE_ bool is_released() { return released; }
_FORCE_INLINE_ bool is_weak() { return weak; }
_FORCE_INLINE_ MonoObject *get_target() const { return released ? NULL : mono_gchandle_get_target(handle); }