Skip to content

Commit 7376e72

Browse files
committed
Revert "Update Object.GetObject() to use JniRuntime.JniValueManager"
This reverts commit f3c122e. This doens't build, because d3cde47 turns all warnings into errors, and this commit introduces a warning. PR #9728 is the proper fix.
1 parent f3c122e commit 7376e72

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/Mono.Android/Java.Lang/Object.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,13 @@ protected void SetHandle (IntPtr value, JniHandleOwnership transfer)
156156
if (handle == IntPtr.Zero)
157157
return null;
158158

159-
var p = JNIEnvInit.ValueManager!.GetPeer (new JniObjectReference (handle), type);
160-
JNIEnv.DeleteRef (handle, transfer);
161-
return p;
159+
var r = PeekObject (handle, type);
160+
if (r != null) {
161+
JNIEnv.DeleteRef (handle, transfer);
162+
return r;
163+
}
164+
165+
return Java.Interop.TypeManager.CreateInstance (handle, transfer, type);
162166
}
163167

164168
[EditorBrowsable (EditorBrowsableState.Never)]

0 commit comments

Comments
 (0)