mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +01:00
fix to not crash, and exit cleanly, when opening unopenable games
When e.g. I open a game saved with a newer stream version flag it as bad rather than asserting each time.
This commit is contained in:
parent
e7861dca48
commit
93e6e315db
2 changed files with 10 additions and 16 deletions
|
@ -101,6 +101,7 @@ public class Quarantine {
|
||||||
store();
|
store();
|
||||||
Log.d( TAG, "markBad(%d): %s", rowid, sDataRef[0].toString() );
|
Log.d( TAG, "markBad(%d): %s", rowid, sDataRef[0].toString() );
|
||||||
}
|
}
|
||||||
|
GameListItem.inval( rowid );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class QData implements Serializable {
|
private static class QData implements Serializable {
|
||||||
|
|
|
@ -37,6 +37,7 @@ import org.eehouse.android.xw4.DupeModeTimer;
|
||||||
import org.eehouse.android.xw4.GameLock;
|
import org.eehouse.android.xw4.GameLock;
|
||||||
import org.eehouse.android.xw4.GameUtils;
|
import org.eehouse.android.xw4.GameUtils;
|
||||||
import org.eehouse.android.xw4.Log;
|
import org.eehouse.android.xw4.Log;
|
||||||
|
import org.eehouse.android.xw4.Quarantine;
|
||||||
import org.eehouse.android.xw4.R;
|
import org.eehouse.android.xw4.R;
|
||||||
import org.eehouse.android.xw4.Utils;
|
import org.eehouse.android.xw4.Utils;
|
||||||
import org.eehouse.android.xw4.XWPrefs;
|
import org.eehouse.android.xw4.XWPrefs;
|
||||||
|
@ -234,24 +235,15 @@ public class JNIThread extends Thread implements AutoCloseable {
|
||||||
utils, null, cp, m_xport );
|
utils, null, cp, m_xport );
|
||||||
}
|
}
|
||||||
if ( null == m_jniGamePtr ) {
|
if ( null == m_jniGamePtr ) {
|
||||||
// I don't think games get created here. If they do, I
|
Quarantine.markBad( m_rowid );
|
||||||
// need to get the selfAddr from somewhere other than
|
success = false;
|
||||||
// generic defaults, as the user should have configured an
|
} else {
|
||||||
// address for the game.
|
notifyAll();
|
||||||
Assert.assertTrueNR( m_gi.serverRole != DeviceRole.SERVER_ISCLIENT );
|
|
||||||
Assert.failDbg(); // Do I ever get here????
|
m_lastSavedState = Arrays.hashCode( stream );
|
||||||
CommsAddrRec selfAddr = CommsAddrRec.getSelfAddr( context, m_gi );
|
DupeModeTimer.gameOpened( m_context, m_rowid );
|
||||||
CommsAddrRec hostAddr = null;
|
|
||||||
m_jniGamePtr = XwJNI.initNew( m_gi, selfAddr, hostAddr,
|
|
||||||
utils, null, cp, m_xport );
|
|
||||||
}
|
}
|
||||||
Assert.assertNotNull( m_jniGamePtr );
|
|
||||||
notifyAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_lastSavedState = Arrays.hashCode( stream );
|
|
||||||
|
|
||||||
DupeModeTimer.gameOpened( m_context, m_rowid );
|
|
||||||
}
|
}
|
||||||
Log.d( TAG, "configure() => %b", success );
|
Log.d( TAG, "configure() => %b", success );
|
||||||
return success;
|
return success;
|
||||||
|
@ -274,6 +266,7 @@ public class JNIThread extends Thread implements AutoCloseable {
|
||||||
// this thread unless it's doing something interruptable
|
// this thread unless it's doing something interruptable
|
||||||
// (like blocking on a socket) so might as well let it
|
// (like blocking on a socket) so might as well let it
|
||||||
// take however log it takes. If that's too long, fix it.
|
// take however log it takes. If that's too long, fix it.
|
||||||
|
interrupt();
|
||||||
join();
|
join();
|
||||||
// Assert.assertFalse( isAlive() );
|
// Assert.assertFalse( isAlive() );
|
||||||
} catch ( java.lang.InterruptedException ie ) {
|
} catch ( java.lang.InterruptedException ie ) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue