on ICS CreateGlobalRef doesn't return the same value as is passed in.

So stop assuming it does!  Fixes multiple crashes on ICS and need to
be ported to android_branch.
This commit is contained in:
Eric House 2012-02-05 19:11:38 -08:00
parent bc8299fe30
commit 8947ddca0b
3 changed files with 4 additions and 5 deletions

View file

@ -140,8 +140,8 @@ andMakeBitmap( AndDictionaryCtxt* ctxt, XP_U8 const** ptrp,
JNIEnv* env = ctxt->env;
bitmap = and_util_makeJBitmap( ctxt->jniutil, nCols, nRows, colors );
(void)(*env)->NewGlobalRef( env, bitmap );
(*env)->DeleteLocalRef( env, bitmap );
bitmap = (*env)->NewGlobalRef( env, bitmap );
XP_FREE( ctxt->super.mpool, colors );
#endif
}

View file

@ -54,10 +54,10 @@ makeJRect( AndDraw* draw, int indx, const XP_Rect* rect )
right, bottom );
(*env)->DeleteLocalRef( env, rclass );
draw->jCache[indx] = robj;
robj = (*env)->NewGlobalRef( env, robj );
(*env)->DeleteLocalRef( env, robj );
robj = (*env)->NewGlobalRef( env, robj );
draw->jCache[indx] = robj;
} else {
setInt( env, robj, "left", rect->left );
setInt( env, robj, "top", rect->top );
@ -81,8 +81,8 @@ makeDSI( AndDraw* draw, int indx, const DrawScoreInfo* dsi )
dsiobj = (*env)->NewObject( env, rclass, initId );
(*env)->DeleteLocalRef( env, rclass );
dsiobj = (*env)->NewGlobalRef( env, dsiobj );
(*env)->DeleteLocalRef( env, dsiobj );
dsiobj = (*env)->NewGlobalRef( env, dsiobj );
draw->jCache[indx] = dsiobj;
}

View file

@ -177,7 +177,6 @@ makeXportProcs( MPFORMAL JNIEnv** envp, jobject jxport )
if ( NULL != jxport ) {
aprocs->jxport = (*env)->NewGlobalRef( env, jxport );
}
XP_ASSERT( aprocs->jxport == jxport );
aprocs->envp = envp;
MPASSIGN( aprocs->mpool, mpool );