diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-07-25 03:07:16 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-07-25 03:07:16 +0200 |
commit | 2db2a0921dcbeefecd45a82c484bf22f76da058f (patch) | |
tree | 07cd24b4fccbb5f6ccdfbb9aec01d73b1be7b7b9 /app/src/main/java/com | |
parent | d7889c4e883b906b4cf718a7195be0857e9e7526 (diff) |
MainActivity: attempt to fix commit state exceptions
This is an attempt to fix:
java.lang.IllegalStateException:
at android.support.v4.app.FragmentManagerImpl.checkStateLoss (FragmentManager.java:2053)
at android.support.v4.app.FragmentManagerImpl.enqueueAction (FragmentManager.java:2079)
at android.support.v4.app.BackStackRecord.commitInternal (BackStackRecord.java:678)
at android.support.v4.app.BackStackRecord.commit (BackStackRecord.java:632)
at com.wireguard.android.activity.MainActivity.moveToState (MainActivity.java:58)
at com.wireguard.android.activity.MainActivity.onSelectedTunnelChanged (MainActivity.java:157)
at com.wireguard.android.activity.BaseActivity.setSelectedTunnel (BaseActivity.java:75)
at com.wireguard.android.fragment.BaseFragment.setSelectedTunnel (BaseFragment.java:82)
at com.wireguard.android.fragment.TunnelListFragment.lambda$null$4$TunnelListFragment (TunnelListFragment.java:307)
at com.wireguard.android.fragment.TunnelListFragment$$Lambda$4.onClick (Unknown Source:6)
at android.view.View.performClick (View.java:6274)
at android.view.View$PerformClick.run (View.java:24729)
at android.os.Handler.handleCallback (Handler.java:789)
at android.os.Handler.dispatchMessage (Handler.java:98)
at android.os.Looper.loop (Looper.java:169)
at android.app.ActivityThread.main (ActivityThread.java:6595)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:240)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:767)
But this is probably the wrong way to fix it and instead moveToState
needs to be reimagined.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/java/com')
-rw-r--r-- | app/src/main/java/com/wireguard/android/activity/MainActivity.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/src/main/java/com/wireguard/android/activity/MainActivity.java b/app/src/main/java/com/wireguard/android/activity/MainActivity.java index 5a8134f3..b3c21133 100644 --- a/app/src/main/java/com/wireguard/android/activity/MainActivity.java +++ b/app/src/main/java/com/wireguard/android/activity/MainActivity.java @@ -55,7 +55,7 @@ public class MainActivity extends BaseActivity { .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); if (state.layer > 0) transaction.addToBackStack(null); - transaction.commit(); + transaction.commitAllowingStateLoss(); /* TODO: switch back to .commit() when this function is rewritten. */ } else if (nextState.layer == state.layer - 1) { if (fragmentManager.getBackStackEntryCount() == 0) return false; |