diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.kt b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.kt index 743acdb89..b2fe07c42 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.kt +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.kt @@ -552,11 +552,13 @@ class BoardDelegate(delegator: Delegator) : } override fun onDestroy() { + Log.d( TAG, "onDestroy()" ) closeIfFinishing(true) releaseThreadOnce() GamesListDelegate.boardDestroyed(mRowid) noteClosed(mRowid) super.onDestroy() + Log.d( TAG, "onDestroy() DONE" ) } @Throws(Throwable::class) diff --git a/xwords4/android/jni/xwjni.c b/xwords4/android/jni/xwjni.c index 17a112722..7fe6733a8 100644 --- a/xwords4/android/jni/xwjni.c +++ b/xwords4/android/jni/xwjni.c @@ -238,8 +238,11 @@ map_remove_prv( EnvThreadInfo* ti, JNIEnv* env, const char* caller ) found = env == entry->env; if ( found ) { if ( pthread_self() != entry->owner ) { - XP_LOGFF( "mismatch; called from %s", caller ); - XP_ASSERT(0); + XP_LOGFF( "mismatch; called from %s (but mapped by %s()?", + caller, entry->ownerFunc ); + /* XP_ASSERT(0);*/ /* <-- Is this causing ANRs? Does NOT + show up as an assert sometimes anyway, though it does kill + the thread. */ } # ifdef LOG_MAPPING RAW_LOG( "UNMAPPED env %p to thread %x (called from %s(); mapped by %s)", @@ -247,7 +250,9 @@ map_remove_prv( EnvThreadInfo* ti, JNIEnv* env, const char* caller ) RAW_LOG( "%d entries left", countUsed( ti ) ); entry->ownerFunc = NULL; # endif - XP_ASSERT( 1 == entry->refcount ); + if ( 1 != entry->refcount ) { + XP_LOGFF( "ERROR: refcount %d, not 1", entry->refcount ); + } --entry->refcount; entry->env = NULL; entry->owner = 0;