mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +01:00
fix invite alert not being dismissed on game connect
At least where QR was being used, it didn't go away. Not sure why, but a global was getting nulled when it shouldn't have been. Race condition I guess.
This commit is contained in:
parent
177bb28a67
commit
a11db395d5
4 changed files with 11 additions and 7 deletions
|
@ -671,7 +671,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
|
||||||
final int CLIP_SAVE_FLAG = 0x02;
|
final int CLIP_SAVE_FLAG = 0x02;
|
||||||
try {
|
try {
|
||||||
sSaveMethod.invoke( this, CLIP_SAVE_FLAG );
|
sSaveMethod.invoke( this, CLIP_SAVE_FLAG );
|
||||||
Log.d( TAG, "saveImpl() worked" );
|
// Log.d( TAG, "saveImpl() worked" );
|
||||||
} catch ( java.lang.reflect.InvocationTargetException
|
} catch ( java.lang.reflect.InvocationTargetException
|
||||||
| IllegalAccessException ex ) {
|
| IllegalAccessException ex ) {
|
||||||
Log.e( TAG, "%s", ex );
|
Log.e( TAG, "%s", ex );
|
||||||
|
|
|
@ -1457,7 +1457,7 @@ public class BoardDelegate extends DelegateBase
|
||||||
@Override
|
@Override
|
||||||
public void tpmCountChanged( final int newCount )
|
public void tpmCountChanged( final int newCount )
|
||||||
{
|
{
|
||||||
Log.d( TAG, "tpmCountChanged(%d)", newCount );
|
Log.d( TAG, "tpmCountChanged(newCount=%d)", newCount );
|
||||||
ConnStatusHandler.updateMoveCount( m_activity, newCount );
|
ConnStatusHandler.updateMoveCount( m_activity, newCount );
|
||||||
|
|
||||||
final GameOverAlert goAlert = mGameOverAlert;
|
final GameOverAlert goAlert = mGameOverAlert;
|
||||||
|
|
|
@ -54,15 +54,18 @@ public class InviteChoicesAlert extends DlgDelegateAlert
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void dismissAny()
|
public static boolean dismissAny()
|
||||||
{
|
{
|
||||||
|
boolean dismissed = false;
|
||||||
WeakReference<InviteChoicesAlert> ref = sSelf;
|
WeakReference<InviteChoicesAlert> ref = sSelf;
|
||||||
if ( null != ref ) {
|
if ( null != ref ) {
|
||||||
InviteChoicesAlert self = ref.get();
|
InviteChoicesAlert self = ref.get();
|
||||||
if ( null != self ) {
|
if ( null != self ) {
|
||||||
self.dismiss();
|
self.dismiss();
|
||||||
|
dismissed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return dismissed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InviteChoicesAlert() {}
|
public InviteChoicesAlert() {}
|
||||||
|
|
|
@ -75,8 +75,7 @@ class InvitesNeededAlert {
|
||||||
{
|
{
|
||||||
Log.d( TAG, "dismiss()" );
|
Log.d( TAG, "dismiss()" );
|
||||||
DbgUtils.assertOnUIThread();
|
DbgUtils.assertOnUIThread();
|
||||||
if ( null != mSelf ) {
|
if ( null != mSelf && mSelf.close() ) {
|
||||||
mSelf.close();
|
|
||||||
mSelf = null;
|
mSelf = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,17 +112,19 @@ class InvitesNeededAlert {
|
||||||
void onInfoClicked();
|
void onInfoClicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void close()
|
private boolean close()
|
||||||
{
|
{
|
||||||
|
boolean dismissed = false;
|
||||||
DbgUtils.assertOnUIThread();
|
DbgUtils.assertOnUIThread();
|
||||||
if ( null != mAlert ) {
|
if ( null != mAlert ) {
|
||||||
InviteChoicesAlert.dismissAny();
|
dismissed = InviteChoicesAlert.dismissAny();
|
||||||
try {
|
try {
|
||||||
mAlert.dismiss(); // I've seen this throw a NPE inside
|
mAlert.dismiss(); // I've seen this throw a NPE inside
|
||||||
} catch ( Exception ex ) {
|
} catch ( Exception ex ) {
|
||||||
Log.ex( TAG, ex );
|
Log.ex( TAG, ex );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return dismissed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private InvitesNeededAlert( DelegateBase delegate, State state )
|
private InvitesNeededAlert( DelegateBase delegate, State state )
|
||||||
|
|
Loading…
Reference in a new issue