mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-07 20:46:17 +01:00
save game and summary in a synchronized block so lock doesn't get released halfway through
This commit is contained in:
parent
27a5990283
commit
fc799449e9
1 changed files with 9 additions and 6 deletions
|
@ -325,6 +325,8 @@ public class JNIThread extends Thread {
|
||||||
if ( Arrays.equals( m_gameAtStart, state ) ) {
|
if ( Arrays.equals( m_gameAtStart, state ) ) {
|
||||||
// DbgUtils.logf( "no change in game; can skip saving" );
|
// DbgUtils.logf( "no change in game; can skip saving" );
|
||||||
} else {
|
} else {
|
||||||
|
synchronized( this ) {
|
||||||
|
Assert.assertNotNull( m_lock );
|
||||||
GameSummary summary = new GameSummary( m_context, m_gi );
|
GameSummary summary = new GameSummary( m_context, m_gi );
|
||||||
XwJNI.game_summarize( m_jniGamePtr, summary );
|
XwJNI.game_summarize( m_jniGamePtr, summary );
|
||||||
DBUtils.saveGame( m_context, m_lock, state, false );
|
DBUtils.saveGame( m_context, m_lock, state, false );
|
||||||
|
@ -333,6 +335,7 @@ public class JNIThread extends Thread {
|
||||||
XwJNI.game_saveSucceeded( m_jniGamePtr );
|
XwJNI.game_saveSucceeded( m_jniGamePtr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("fallthrough")
|
@SuppressWarnings("fallthrough")
|
||||||
public void run()
|
public void run()
|
||||||
|
|
Loading…
Add table
Reference in a new issue