Convert Runtime.GetINativeObject_[Dynamic|Static] to use GCHandle.
This commit is contained in:
Родитель
e31b9db516
Коммит
8ac784ccfe
|
@ -142,10 +142,10 @@
|
|||
OnlyDynamicUsage = false,
|
||||
},
|
||||
|
||||
new XDelegate ("MonoObject *", "IntPtr", "xamarin_get_inative_object_dynamic",
|
||||
new XDelegate ("GCHandle->MonoObject *", "IntPtr", "xamarin_get_inative_object_dynamic",
|
||||
"id", "IntPtr", "obj",
|
||||
"bool", "bool", "owns",
|
||||
"void *", "IntPtr", "type"
|
||||
"GCHandle->MonoReflectionType *", "IntPtr", "type"
|
||||
) {
|
||||
WrappedManagedFunction = "GetINativeObject_Dynamic",
|
||||
OnlyDynamicUsage = false,
|
||||
|
@ -168,7 +168,7 @@
|
|||
OnlyDynamicUsage = false,
|
||||
},
|
||||
|
||||
new XDelegate ("MonoObject *", "IntPtr", "xamarin_get_inative_object_static",
|
||||
new XDelegate ("GCHandle->MonoObject *", "IntPtr", "xamarin_get_inative_object_static",
|
||||
"id", "IntPtr", "obj",
|
||||
"bool", "bool", "owns",
|
||||
"unsigned int", "uint", "iface_token_ref",
|
||||
|
|
|
@ -689,9 +689,8 @@ namespace ObjCRuntime {
|
|||
/*
|
||||
* This method is called from marshalling bridge (dynamic mode).
|
||||
*/
|
||||
// It doesn't work to use System.Type in the signature, we get garbage.
|
||||
var type = (System.Type) ObjectWrapper.Convert (type_ptr);
|
||||
return ObjectWrapper.Convert (GetINativeObject (ptr, owns, type));
|
||||
var type = (System.Type) GetGCHandleTarget (type_ptr);
|
||||
return AllocGCHandle (GetINativeObject (ptr, owns, type));
|
||||
}
|
||||
|
||||
static IntPtr GetINativeObject_Static (IntPtr ptr, bool owns, uint iface_token, uint implementation_token)
|
||||
|
@ -702,7 +701,7 @@ namespace ObjCRuntime {
|
|||
|
||||
var iface = Class.ResolveTypeTokenReference (iface_token);
|
||||
var type = Class.ResolveTypeTokenReference (implementation_token);
|
||||
return ObjectWrapper.Convert (GetINativeObject (ptr, owns, iface, type));
|
||||
return AllocGCHandle (GetINativeObject (ptr, owns, iface, type));
|
||||
}
|
||||
|
||||
static IntPtr GetNSObjectWithType (IntPtr ptr, IntPtr type_ptr, out bool created)
|
||||
|
|
Загрузка…
Ссылка в новой задаче