diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListItem.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListItem.java index ff5f673c0..112c670a7 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListItem.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListItem.java @@ -351,26 +351,30 @@ public class GameListItem extends LinearLayout @Override protected GameSummary doInBackground( Void... unused ) { - return DBUtils.getSummary( m_context, m_rowid, SUMMARY_WAIT_MSECS ); + GameSummary result = null; + + JNIThread thread = JNIThread.getRetained( m_rowid ); + if ( null != thread ) { + GameLock lock = thread.getLock(); + if ( null != lock ) { + result = DBUtils.getSummary( m_context, lock ); + } + thread.release( false ); + } + + if ( null == result ) { + result = DBUtils.getSummary( m_context, m_rowid, SUMMARY_WAIT_MSECS ); + } + return result; } // doInBackground @Override protected void onPostExecute( GameSummary summary ) { if ( 0 == --m_loadingCount ) { - if ( null == summary ) { - // Try again. Maybe it's open - JNIThread thread = JNIThread.getRetained( m_rowid ); - if ( null != thread ) { - summary = DBUtils.getSummary( m_context, - thread.getLock() ); - thread.release(); - } - } - m_summary = summary; - boolean expanded = DBUtils.getExpanded( m_context, m_rowid ); + boolean expanded = DBUtils.getExpanded( m_context, m_rowid ); makeThumbnailIf( expanded ); setData( summary, expanded ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java index dd087a0cd..f88d18c90 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java @@ -752,7 +752,9 @@ public class JNIThread extends Thread { return this; } - public void release() + public void release() { release( true ); } + + public void release( boolean save ) { boolean stop = false; synchronized( s_instances ) { @@ -766,7 +768,7 @@ public class JNIThread extends Thread { if ( stop ) { waitToStop( true ); - } else if ( null != m_lastSavedState ) { // has configure() run? + } else if ( save && null != m_lastSavedState ) { // has configure() run? handle( JNICmd.CMD_SAVE ); // in case releaser has made changes } }