mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-23 07:27:22 +01:00
fix crash by not creating Handler until on UI thread
Receiver is created and installed by a non-UI thread sometimes so can't create the Handler there. onReceive() is called on an ok thread however so create it there on demand. Fixes crash that showed when receiving relay messages in background.
This commit is contained in:
parent
390370c07a
commit
ba95432e44
1 changed files with 5 additions and 2 deletions
|
@ -181,8 +181,6 @@ public class NetStateCache {
|
|||
|
||||
public PvtBroadcastReceiver()
|
||||
{
|
||||
// DbgUtils.assertOnUIThread(); // firing
|
||||
mHandler = new Handler();
|
||||
mLastStateSent = s_netAvail;
|
||||
}
|
||||
|
||||
|
@ -191,6 +189,11 @@ public class NetStateCache {
|
|||
{
|
||||
DbgUtils.assertOnUIThread();
|
||||
|
||||
if ( null == mHandler ) {
|
||||
DbgUtils.assertOnUIThread();
|
||||
mHandler = new Handler();
|
||||
}
|
||||
|
||||
if ( intent.getAction().
|
||||
equals( ConnectivityManager.CONNECTIVITY_ACTION)) {
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue