summaryrefslogtreecommitdiffstats
path: root/modules/mono/mono_gd/gd_mono_cache.cpp
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2019-12-11 17:08:40 +0100
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2020-03-17 21:51:05 +0100
commit0b814ea78d6b065e8e0785155207bd80b3d845c8 (patch)
tree6513402706d55505ec57cf88c97db5633ffabb9a /modules/mono/mono_gd/gd_mono_cache.cpp
parent989a223c5a6d6ba5b1b098be8983888cb49b2525 (diff)
downloadredot-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_cache.cpp')
-rw-r--r--modules/mono/mono_gd/gd_mono_cache.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/mono/mono_gd/gd_mono_cache.cpp b/modules/mono/mono_gd/gd_mono_cache.cpp
index 7a3234b69b..418de87b5d 100644
--- a/modules/mono/mono_gd/gd_mono_cache.cpp
+++ b/modules/mono/mono_gd/gd_mono_cache.cpp
@@ -186,7 +186,7 @@ void CachedData::clear_godot_api_cache() {
// End of MarshalUtils methods
- task_scheduler_handle = Ref<MonoGCHandle>();
+ task_scheduler_handle = Ref<MonoGCHandleRef>();
}
#define GODOT_API_CLASS(m_class) (GDMono::get_singleton()->get_core_api_assembly()->get_class(BINDINGS_NAMESPACE, #m_class))
@@ -316,7 +316,7 @@ void update_godot_api_cache() {
// TODO Move to CSharpLanguage::init() and do handle disposal
MonoObject *task_scheduler = mono_object_new(mono_domain_get(), GODOT_API_CLASS(GodotTaskScheduler)->get_mono_ptr());
GDMonoUtils::runtime_object_init(task_scheduler, GODOT_API_CLASS(GodotTaskScheduler));
- cached_data.task_scheduler_handle = MonoGCHandle::create_strong(task_scheduler);
+ cached_data.task_scheduler_handle = MonoGCHandleRef::create_strong(task_scheduler);
cached_data.godot_api_cache_updated = true;
}