From f9cd6190db5e3b8d18abdc2a4d589dd172ec74f5 Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 14 Mar 2012 20:26:23 -0700 Subject: [PATCH] don't call DeleteLocalRef on an object to be returned from the JNI. Crashes ICS bigtime. This needs to be ported back to android_branch. --- xwords4/android/XWords4/jni/xwjni.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/xwords4/android/XWords4/jni/xwjni.c b/xwords4/android/XWords4/jni/xwjni.c index 079375a81..add7db2d8 100644 --- a/xwords4/android/XWords4/jni/xwjni.c +++ b/xwords4/android/XWords4/jni/xwjni.c @@ -316,7 +316,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1getChars { jobject result = NULL; result = and_dictionary_getChars( env, (DictionaryCtxt*)dictPtr ); - (*env)->DeleteLocalRef( env, result ); + // (*env)->DeleteLocalRef( env, result ); return result; } @@ -534,7 +534,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1saveToStream (*env)->ReleaseByteArrayElements( env, result, jelems, 0 ); stream_destroy( stream ); - (*env)->DeleteLocalRef( env, result ); + // (*env)->DeleteLocalRef( env, result ); XWJNI_END(); return result; } @@ -857,7 +857,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1formatRemainingTiles board_formatRemainingTiles( state->game.board, stream ); result = streamToJString( env, stream ); stream_destroy( stream ); - (*env)->DeleteLocalRef( env, result ); + // (*env)->DeleteLocalRef( env, result ); XWJNI_END(); return result; @@ -873,7 +873,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1formatDictCounts server_formatDictCounts( state->game.server, stream, nCols ); result = streamToJString( env, stream ); stream_destroy( stream ); - (*env)->DeleteLocalRef( env, result ); + // (*env)->DeleteLocalRef( env, result ); XWJNI_END(); return result; } @@ -899,7 +899,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_model_1writeGameHistory model_writeGameHistory( state->game.model, stream, state->game.server, gameOver ); result = streamToJString( env, stream ); - (*env)->DeleteLocalRef( env, result ); + // (*env)->DeleteLocalRef( env, result ); stream_destroy( stream ); XWJNI_END(); return result; @@ -931,7 +931,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_model_1getPlayersLastScore buf[0] = '\0'; } result = (*env)->NewStringUTF( env, buf ); - (*env)->DeleteLocalRef( env, result ); + // (*env)->DeleteLocalRef( env, result ); XWJNI_END(); return result; } @@ -945,7 +945,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1writeFinalScores XWStreamCtxt* stream = and_empty_stream( MPPARM(mpool) globals ); server_writeFinalScores( state->game.server, stream ); result = streamToJString( env, stream ); - (*env)->DeleteLocalRef( env, result ); + // (*env)->DeleteLocalRef( env, result ); stream_destroy( stream ); XWJNI_END(); return result; @@ -1425,7 +1425,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getCounts if ( 0 < dict_countWords( &iter, &lens ) ) { XP_ASSERT( sizeof(jint) == sizeof(lens.lens[0]) ); result = makeIntArray( env, VSIZE(lens.lens), (jint*)&lens.lens ); - (*env)->DeleteLocalRef( env, result ); + // (*env)->DeleteLocalRef( env, result ); } } return result; @@ -1451,7 +1451,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getPrefixes (*env)->SetObjectArrayElement( env, result, ii, jstr ); (*env)->DeleteLocalRef( env, jstr ); } - (*env)->DeleteLocalRef( env, result ); + // (*env)->DeleteLocalRef( env, result ); } return result; } @@ -1467,7 +1467,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1getIndices XP_ASSERT( sizeof(jint) == sizeof(data->idata.indices[0]) ); jindices = makeIntArray( env, data->idata.count, (jint*)data->idata.indices ); - (*env)->DeleteLocalRef( env, jindices ); + // (*env)->DeleteLocalRef( env, jindices ); } return jindices; } @@ -1483,7 +1483,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1nthWord XP_UCHAR buf[64]; dict_wordToString( &data->iter, buf, VSIZE(buf) ); result = (*env)->NewStringUTF( env, buf ); - (*env)->DeleteLocalRef( env, result ); + // (*env)->DeleteLocalRef( env, result ); } } return result;