mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
fix NPE in race; no longer any need to set preferred orientation; do a
bit of asserting trying to catch another race.
This commit is contained in:
parent
58cb40b08e
commit
bcf767d66e
1 changed files with 10 additions and 11 deletions
|
@ -77,7 +77,6 @@ public class BoardActivity extends XWActivity
|
||||||
private TimerRunnable[] m_timers;
|
private TimerRunnable[] m_timers;
|
||||||
private String m_path;
|
private String m_path;
|
||||||
private Uri m_uri;
|
private Uri m_uri;
|
||||||
private int m_currentOrient;
|
|
||||||
private Toolbar m_toolbar;
|
private Toolbar m_toolbar;
|
||||||
private ArrayList<String> m_pendingChats = new ArrayList<String>();
|
private ArrayList<String> m_pendingChats = new ArrayList<String>();
|
||||||
|
|
||||||
|
@ -1119,9 +1118,12 @@ public class BoardActivity extends XWActivity
|
||||||
showDialog( QUERY_ENDGAME );
|
showDialog( QUERY_ENDGAME );
|
||||||
break;
|
break;
|
||||||
case JNIThread.TOOLBAR_STATES:
|
case JNIThread.TOOLBAR_STATES:
|
||||||
|
if ( null != m_jniThread ) {
|
||||||
m_gsi = m_jniThread.getGameStateInfo();
|
m_gsi = m_jniThread.getGameStateInfo();
|
||||||
updateToolbar();
|
updateToolbar();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
// see http://stackoverflow.com/questions/680180/where-to-stop-\
|
// see http://stackoverflow.com/questions/680180/where-to-stop-\
|
||||||
|
@ -1233,7 +1235,6 @@ public class BoardActivity extends XWActivity
|
||||||
{
|
{
|
||||||
return new DialogInterface.OnDismissListener() {
|
return new DialogInterface.OnDismissListener() {
|
||||||
public void onDismiss( DialogInterface di ) {
|
public void onDismiss( DialogInterface di ) {
|
||||||
setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_SENSOR );
|
|
||||||
releaseIfBlocking();
|
releaseIfBlocking();
|
||||||
removeDialog( id );
|
removeDialog( id );
|
||||||
}
|
}
|
||||||
|
@ -1244,31 +1245,29 @@ public class BoardActivity extends XWActivity
|
||||||
* interrupted before the runnable gets run. In that case there's
|
* interrupted before the runnable gets run. In that case there's
|
||||||
* no dialog to dismiss. So track it.
|
* no dialog to dismiss. So track it.
|
||||||
*/
|
*/
|
||||||
private boolean m_blockingDlgPosted;
|
private boolean m_blockingDlgPosted = false;
|
||||||
|
|
||||||
private int waitBlockingDialog( final int dlgID, int cancelResult )
|
private int waitBlockingDialog( final int dlgID, int cancelResult )
|
||||||
{
|
{
|
||||||
m_blockingDlgPosted = false;
|
Assert.assertFalse( m_blockingDlgPosted );
|
||||||
setBlockingThread();
|
setBlockingThread();
|
||||||
int orient = m_currentOrient == Configuration.ORIENTATION_LANDSCAPE
|
|
||||||
? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
|
|
||||||
: ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
|
|
||||||
setRequestedOrientation( orient );
|
|
||||||
|
|
||||||
m_handler.post( new Runnable() {
|
m_handler.post( new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
showDialog( dlgID );
|
showDialog( dlgID ); // crash
|
||||||
m_blockingDlgPosted = true;
|
m_blockingDlgPosted = true;
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
m_forResultWait.acquire();
|
m_forResultWait.acquire();
|
||||||
|
m_blockingDlgPosted = false;
|
||||||
} catch ( java.lang.InterruptedException ie ) {
|
} catch ( java.lang.InterruptedException ie ) {
|
||||||
Utils.logf( "waitBlockingDialog: got " + ie.toString() );
|
Utils.logf( "waitBlockingDialog: got " + ie.toString() );
|
||||||
m_resultCode = cancelResult;
|
m_resultCode = cancelResult;
|
||||||
if ( m_blockingDlgPosted ) {
|
if ( m_blockingDlgPosted ) {
|
||||||
dismissDialog( dlgID );
|
dismissDialog( dlgID );
|
||||||
|
m_blockingDlgPosted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clearBlockingThread();
|
clearBlockingThread();
|
||||||
|
|
Loading…
Reference in a new issue