[mono-android] Mono for Android 1.9.2 Preview Released

Jonathan Pryor jonp at xamarin.com
Mon Nov 7 13:34:29 EST 2011


On Oct 31, 2011, at 6:39 AM, sound wrote:
> In previous versions I have used JNIEnv::GetObjectRefType() to identify
> object type and remove it. Android.Runtime.JObjectRefType is internal, so
> how i can implement this functionality now?

It was removed because it doesn't work:

	http://developer.android.com/guide/practices/design/jni.html#unsupported

	• GetObjectRefType (new in JNI 1.6) is implemented but not fully functional — it can't always tell the difference between "local" and "global" references.

If you're depending on it, your code is broken. It's _probably_ been fixed in v4.0, but this is of no help for all the previous platforms. This is also why 1.9.2 changed all IntPtr parameters which "consume" the IntPtr into a (IntPtr, JniHandleOwnership) pair, and JniHandleOwnership specifies which type of reference the IntPtr contains.

Consequently, you need to store the type reference type alongside the reference, so that you can properly delete the reference.

 - Jon



More information about the Monodroid mailing list