don't return from getSummary without succeeding, even if must wait on

lock.  Fixes problem with blank entries in game list after returning
from config screen.
This commit is contained in:
Eric House 2012-07-03 20:30:31 -07:00
parent 60a799ef1f
commit 1ad0a899f0
3 changed files with 6 additions and 13 deletions

View file

@ -77,18 +77,12 @@ public class DBUtils {
boolean sourceLocal;
}
public static GameSummary getSummary( Context context, long rowid,
boolean wait )
public static GameSummary getSummary( Context context, long rowid )
{
GameSummary result = null;
GameUtils.GameLock lock = new GameUtils.GameLock( rowid, false );
if ( wait ) {
result = getSummary( context, lock.lock() );
lock.unlock();
} else if ( lock.tryLock() ) {
result = getSummary( context, lock );
lock.unlock();
}
result = getSummary( context, lock.lock() );
lock.unlock();
return result;
}

View file

@ -119,7 +119,7 @@ public class GameListAdapter extends XWListAdapter {
// DbgUtils.logf( "doInBackground(id=%d)", m_id );
View layout = m_factory.inflate( R.layout.game_list_item, null );
boolean hideTitle = false;//CommonPrefs.getHideTitleBar(m_context);
GameSummary summary = DBUtils.getSummary( m_context, m_rowid, false );
GameSummary summary = DBUtils.getSummary( m_context, m_rowid );
if ( null == summary ) {
m_rowid = -1;
} else {

View file

@ -472,7 +472,7 @@ public class GamesList extends XWListActivity
// We need a way to let the user get back to the basic-config
// dialog in case it was dismissed. That way it to check for
// an empty room name.
GameSummary summary = DBUtils.getSummary( this, rowid, true );
GameSummary summary = DBUtils.getSummary( this, rowid );
if ( summary.conType == CommsAddrRec.CommsConnType.COMMS_CONN_RELAY
&& summary.roomName.length() == 0 ) {
// If it's unconfigured and of the type RelayGameActivity
@ -612,8 +612,7 @@ public class GamesList extends XWListActivity
break;
case R.id.list_item_copy:
GameSummary summary = DBUtils.getSummary( this,
m_rowid, true );
GameSummary summary = DBUtils.getSummary( this, m_rowid );
if ( summary.inNetworkGame() ) {
showOKOnlyDialog( R.string.no_copy_network );
} else {