mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
close down jni thread before saving game to fix occasional assertion
fail occuring when draw and save were in the jni at the same time.
This commit is contained in:
parent
5f6c8fd579
commit
62b586d322
1 changed files with 7 additions and 4 deletions
|
@ -333,12 +333,10 @@ public class BoardActivity extends Activity implements UtilCtxt {
|
||||||
return super.onKeyUp( keyCode, event );
|
return super.onKeyUp( keyCode, event );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void onDestroy()
|
protected void onDestroy()
|
||||||
{
|
{
|
||||||
if ( 0 != m_jniGamePtr ) {
|
if ( 0 != m_jniGamePtr ) {
|
||||||
byte[] state = XwJNI.game_saveToStream( m_jniGamePtr, null );
|
|
||||||
Utils.saveGame( this, state, m_path );
|
|
||||||
|
|
||||||
if ( null != m_xport ) {
|
if ( null != m_xport ) {
|
||||||
m_xport.waitToStop();
|
m_xport.waitToStop();
|
||||||
}
|
}
|
||||||
|
@ -346,8 +344,13 @@ public class BoardActivity extends Activity implements UtilCtxt {
|
||||||
if ( null != m_jniThread ) {
|
if ( null != m_jniThread ) {
|
||||||
m_jniThread.waitToStop();
|
m_jniThread.waitToStop();
|
||||||
Utils.logf( "onDestroy(): waitToStop() returned" );
|
Utils.logf( "onDestroy(): waitToStop() returned" );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This has to happen after the drawing thread is killed
|
||||||
|
// to avoid the possibility of reentering the jni world.
|
||||||
|
byte[] state = XwJNI.game_saveToStream( m_jniGamePtr, null );
|
||||||
|
Utils.saveGame( this, state, m_path );
|
||||||
|
|
||||||
XwJNI.game_dispose( m_jniGamePtr );
|
XwJNI.game_dispose( m_jniGamePtr );
|
||||||
m_jniGamePtr = 0;
|
m_jniGamePtr = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue