mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
fix rare crash by tracking whether showDialog has been called and
testing that before dismissing it.
This commit is contained in:
parent
ecfe1d110e
commit
eb3b83ec48
1 changed files with 12 additions and 2 deletions
|
@ -1215,8 +1215,15 @@ public class BoardActivity extends XWActivity
|
|||
};
|
||||
}
|
||||
|
||||
/* m_blockingDlgPosted: very rarely m_forResultWait will get
|
||||
* interrupted before the runnable gets run. In that case there's
|
||||
* no dialog to dismiss. So track it.
|
||||
*/
|
||||
private boolean m_blockingDlgPosted;
|
||||
|
||||
private int waitBlockingDialog( final int dlgID, int cancelResult )
|
||||
{
|
||||
m_blockingDlgPosted = false;
|
||||
setBlockingThread();
|
||||
int orient = m_currentOrient == Configuration.ORIENTATION_LANDSCAPE
|
||||
? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
|
||||
|
@ -1226,15 +1233,18 @@ public class BoardActivity extends XWActivity
|
|||
m_handler.post( new Runnable() {
|
||||
public void run() {
|
||||
showDialog( dlgID );
|
||||
m_blockingDlgPosted = true;
|
||||
}
|
||||
} );
|
||||
|
||||
try {
|
||||
m_forResultWait.acquire();
|
||||
} catch ( java.lang.InterruptedException ie ) {
|
||||
m_resultCode = cancelResult;
|
||||
dismissDialog( dlgID );
|
||||
Utils.logf( "waitBlockingDialog: got " + ie.toString() );
|
||||
m_resultCode = cancelResult;
|
||||
if ( m_blockingDlgPosted ) {
|
||||
dismissDialog( dlgID );
|
||||
}
|
||||
}
|
||||
clearBlockingThread();
|
||||
return m_resultCode;
|
||||
|
|
Loading…
Add table
Reference in a new issue