You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
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.
This commit is contained in:
@@ -70,8 +70,8 @@ void godot_icall_Object_Disposed(MonoObject *p_obj, Object *p_ptr) {
|
||||
if (data) {
|
||||
CSharpScriptBinding &script_binding = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get();
|
||||
if (script_binding.inited) {
|
||||
Ref<MonoGCHandle> &gchandle = script_binding.gchandle;
|
||||
if (gchandle.is_valid()) {
|
||||
MonoGCHandleData &gchandle = script_binding.gchandle;
|
||||
if (!gchandle.is_released()) {
|
||||
CSharpLanguage::release_script_gchandle(p_obj, gchandle);
|
||||
}
|
||||
}
|
||||
@@ -117,8 +117,8 @@ void godot_icall_Reference_Disposed(MonoObject *p_obj, Object *p_ptr, MonoBoolea
|
||||
if (data) {
|
||||
CSharpScriptBinding &script_binding = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get();
|
||||
if (script_binding.inited) {
|
||||
Ref<MonoGCHandle> &gchandle = script_binding.gchandle;
|
||||
if (gchandle.is_valid()) {
|
||||
MonoGCHandleData &gchandle = script_binding.gchandle;
|
||||
if (!gchandle.is_released()) {
|
||||
CSharpLanguage::release_script_gchandle(p_obj, gchandle);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user