diff options
| author | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2019-12-11 17:08:40 +0100 |
|---|---|---|
| committer | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2020-03-17 21:51:05 +0100 |
| commit | 0b814ea78d6b065e8e0785155207bd80b3d845c8 (patch) | |
| tree | 6513402706d55505ec57cf88c97db5633ffabb9a /modules/mono/mono_gd/gd_mono_internals.cpp | |
| parent | 989a223c5a6d6ba5b1b098be8983888cb49b2525 (diff) | |
| download | redot-engine-0b814ea78d6b065e8e0785155207bd80b3d845c8.tar.gz | |
Mono/C#: Optimize the way we store GC handles for scripts
Don't store GC handles for C# script instances and instance bindings as 'Ref<MonoGCHandle>'; store the raw data instead. Initially this was not possible as we needed to store a Variant, but this had not been the case for a looong time yet the stored type was never updated.
Diffstat (limited to 'modules/mono/mono_gd/gd_mono_internals.cpp')
| -rw-r--r-- | modules/mono/mono_gd/gd_mono_internals.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/mono/mono_gd/gd_mono_internals.cpp b/modules/mono/mono_gd/gd_mono_internals.cpp index f343a1d646..53e642f317 100644 --- a/modules/mono/mono_gd/gd_mono_internals.cpp +++ b/modules/mono/mono_gd/gd_mono_internals.cpp @@ -75,7 +75,7 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) { script_binding.inited = true; script_binding.type_name = NATIVE_GDMONOCLASS_NAME(klass); script_binding.wrapper_class = klass; - script_binding.gchandle = ref ? MonoGCHandle::create_weak(managed) : MonoGCHandle::create_strong(managed); + script_binding.gchandle = ref ? MonoGCHandleData::new_weak_handle(managed) : MonoGCHandleData::new_strong_handle(managed); script_binding.owner = unmanaged; if (ref) { @@ -101,7 +101,7 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) { return; } - Ref<MonoGCHandle> gchandle = ref ? MonoGCHandle::create_weak(managed) : MonoGCHandle::create_strong(managed); + MonoGCHandleData gchandle = ref ? MonoGCHandleData::new_weak_handle(managed) : MonoGCHandleData::new_strong_handle(managed); Ref<CSharpScript> script = CSharpScript::create_for_managed_type(klass, native); |
