From ea205ebf970dc51b649bce1c8b3231c730d1af13 Mon Sep 17 00:00:00 2001 From: Andy2 Date: Wed, 13 Jul 2011 06:13:38 -0700 Subject: [PATCH] when blocking dialogs want to stack, rather than assert, just drop the second one. I'm not sure this is the right thing to do, but it won't matter except when the assert was firing. --- .../eehouse/android/xw4/BoardActivity.java | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java index 84bd11bc2..d2a28842a 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -1232,29 +1232,34 @@ public class BoardActivity extends XWActivity private int waitBlockingDialog( final int dlgID, int cancelResult ) { - Assert.assertFalse( m_blockingDlgPosted ); - setBlockingThread(); + int result = cancelResult; + if ( m_blockingDlgPosted ) { // this has been true; dunno why + Utils.logf( "waitBlockingDialog: dropping dlgID %d", dlgID ); + } else { + setBlockingThread(); - m_handler.post( new Runnable() { - public void run() { - showDialog( dlgID ); // crash - m_blockingDlgPosted = true; - } - } ); + m_handler.post( new Runnable() { + public void run() { + showDialog( dlgID ); // crash + m_blockingDlgPosted = true; + } + } ); - try { - m_forResultWait.acquire(); - m_blockingDlgPosted = false; - } catch ( java.lang.InterruptedException ie ) { - Utils.logf( "waitBlockingDialog: got " + ie.toString() ); - m_resultCode = cancelResult; - if ( m_blockingDlgPosted ) { - dismissDialog( dlgID ); + try { + m_forResultWait.acquire(); m_blockingDlgPosted = false; + } catch ( java.lang.InterruptedException ie ) { + Utils.logf( "waitBlockingDialog: got " + ie.toString() ); + m_resultCode = cancelResult; + if ( m_blockingDlgPosted ) { + dismissDialog( dlgID ); + m_blockingDlgPosted = false; + } } + clearBlockingThread(); + result = m_resultCode; } - clearBlockingThread(); - return m_resultCode; + return result; } private void nonBlockingDialog( final int dlgID, String txt )