don't bother saving if no data loaded yet

Fixes, or at least makes extremely unlikely, race condition where one
thread makes use of an existing JNIThread instance then releases it
before the thread that created it has had a chance to call configure()
to actually load the game.
This commit is contained in:
Eric House 2016-07-26 07:27:13 -07:00
parent 9d95630654
commit 272f8a3960
2 changed files with 2 additions and 1 deletions

View file

@ -1261,6 +1261,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1do
{
jboolean result;
XWJNI_START();
XP_ASSERT( !!state->game.server );
result = server_do( state->game.server );
XWJNI_END();
return result;

View file

@ -766,7 +766,7 @@ public class JNIThread extends Thread {
if ( stop ) {
waitToStop( true );
} else {
} else if ( null != m_lastSavedState ) { // has configure() run?
handle( JNICmd.CMD_SAVE ); // in case releaser has made changes
}
}