From ef92c04135f4c4aaf8fadd784b45d0cd8cfca78a Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 4 May 2020 11:08:32 +0200 Subject: [PATCH] Convert Runtime.GetClass to use GCHandle. --- runtime/delegates.t4 | 2 +- src/ObjCRuntime/Runtime.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/delegates.t4 b/runtime/delegates.t4 index 7dab42f90a..7df5d31f00 100644 --- a/runtime/delegates.t4 +++ b/runtime/delegates.t4 @@ -89,7 +89,7 @@ OnlyDynamicUsage = true, }, - new XDelegate ("MonoObject *", "IntPtr", "xamarin_get_class", + new XDelegate ("GCHandle->MonoObject *", "IntPtr", "xamarin_get_class", "Class", "IntPtr", "ptr" ) { WrappedManagedFunction = "GetClass", diff --git a/src/ObjCRuntime/Runtime.cs b/src/ObjCRuntime/Runtime.cs index ad1b542feb..d8a0e4f910 100644 --- a/src/ObjCRuntime/Runtime.cs +++ b/src/ObjCRuntime/Runtime.cs @@ -628,7 +628,7 @@ namespace ObjCRuntime { static IntPtr GetClass (IntPtr klass) { - return ObjectWrapper.Convert (new Class (klass)); + return AllocGCHandle (new Class (klass)); } static IntPtr GetSelector (IntPtr sel)