mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-23 07:27:22 +01:00
use tryLock() to avoid on-ui-thread assertions
This commit is contained in:
parent
62cd90c183
commit
b0805b0b6a
1 changed files with 13 additions and 18 deletions
|
@ -537,14 +537,13 @@ public class GameConfigDelegate extends DelegateBase
|
|||
m_giOrig = new CurGameInfo( m_activity );
|
||||
|
||||
GameLock gameLock = null;
|
||||
XwJNI.GamePtr gamePtr;
|
||||
XwJNI.GamePtr gamePtr = null;
|
||||
if ( null == m_jniThread ) {
|
||||
try {
|
||||
gameLock = GameLock.getFor( m_rowid ).lockRO();
|
||||
} catch (InterruptedException iex) {
|
||||
Assert.assertFalse( BuildConfig.DEBUG );
|
||||
gameLock = GameLock.getFor( m_rowid ).tryLockRO();
|
||||
if ( null != gameLock ) {
|
||||
gamePtr = GameUtils.loadMakeGame( m_activity, m_giOrig,
|
||||
gameLock );
|
||||
}
|
||||
gamePtr = GameUtils.loadMakeGame( m_activity, m_giOrig, gameLock );
|
||||
} else {
|
||||
gameLock = m_jniThread.getLock();
|
||||
gamePtr = m_jniThread.getGamePtr();
|
||||
|
@ -1234,18 +1233,14 @@ public class GameConfigDelegate extends DelegateBase
|
|||
private void applyChanges( boolean forceNew )
|
||||
{
|
||||
if ( !isFinishing() ) {
|
||||
try {
|
||||
GameLock gameLock = m_jniThread == null
|
||||
? GameLock.getFor( m_rowid ).lock()
|
||||
: m_jniThread.getLock();
|
||||
GameUtils.applyChanges( m_activity, m_gi, m_car, m_disabMap,
|
||||
gameLock, forceNew );
|
||||
DBUtils.saveThumbnail( m_activity, gameLock, null ); // clear it
|
||||
if ( null == m_jniThread ) {
|
||||
gameLock.unlock();
|
||||
}
|
||||
} catch (InterruptedException iex) {
|
||||
Assert.assertFalse( BuildConfig.DEBUG );
|
||||
GameLock gameLock = m_jniThread == null
|
||||
? GameLock.getFor( m_rowid ).tryLock()
|
||||
: m_jniThread.getLock();
|
||||
GameUtils.applyChanges( m_activity, m_gi, m_car, m_disabMap,
|
||||
gameLock, forceNew );
|
||||
DBUtils.saveThumbnail( m_activity, gameLock, null ); // clear it
|
||||
if ( null == m_jniThread ) {
|
||||
gameLock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue