Niedzielski has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311628

Change subject: Avoid Fragment IllegalStateException
......................................................................

Avoid Fragment IllegalStateException

Allowing state loss isn't best practice but custom handling of Fragments
rarely works well. This workaround was intended for f96ce1f and should
be eliminated in T145834.

  java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, 
request=65581, result=-1, data=Intent { (has extras) }} to activity 
{org.wikipedia.beta/org.wikipedia.MainActivity}: 
java.lang.IllegalStateException: Can not perform this action after 
onSaveInstanceState
     at android.app.ActivityThread.deliverResults(ActivityThread.java:3384)
     at android.app.ActivityThread.handleSendResult(ActivityThread.java:3427)
     at android.app.ActivityThread.access$1300(ActivityThread.java:139)
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1248)
     at android.os.Handler.dispatchMessage(Handler.java:102)
     at android.os.Looper.loop(Looper.java:136)
     at android.app.ActivityThread.main(ActivityThread.java:5103)
     at java.lang.reflect.Method.invokeNative(Native Method)
     at java.lang.reflect.Method.invoke(Method.java:515)
     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
     at dalvik.system.NativeStart.main(Native Method)
  Caused by: java.lang.IllegalStateException: Can not perform this action after 
onSaveInstanceState
     at 
android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1527)
     at 
android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1545)
     at 
android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:654)
     at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:621)
     at org.wikipedia.MainFragment.openSearchFragment(MainFragment.java:423)
     at org.wikipedia.MainFragment.onActivityResult(MainFragment.java:129)
     at 
android.support.v4.app.FragmentActivity.onActivityResult(FragmentActivity.java:165)
     at android.app.Activity.dispatchActivityResult(Activity.java:5467)
     at android.app.ActivityThread.deliverResults(ActivityThread.java:3380)
     ... 11 more

https://rink.hockeyapp.net/manage/apps/226650/app_versions/48/crash_reasons/137015016

Change-Id: I6ebdeea38b7925f230060f681828bea0cdcfb508
---
M app/src/main/java/org/wikipedia/MainFragment.java
M app/src/main/java/org/wikipedia/page/PageActivity.java
2 files changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/28/311628/1

diff --git a/app/src/main/java/org/wikipedia/MainFragment.java 
b/app/src/main/java/org/wikipedia/MainFragment.java
index 73e486d..4aafa42 100644
--- a/app/src/main/java/org/wikipedia/MainFragment.java
+++ b/app/src/main/java/org/wikipedia/MainFragment.java
@@ -420,7 +420,7 @@
             getChildFragmentManager()
                     .beginTransaction()
                     .add(R.id.fragment_main_container, fragment)
-                    .commit();
+                    .commitNowAllowingStateLoss();
         }
     }
 
diff --git a/app/src/main/java/org/wikipedia/page/PageActivity.java 
b/app/src/main/java/org/wikipedia/page/PageActivity.java
index 5e5b3ba..ddc3c7c 100644
--- a/app/src/main/java/org/wikipedia/page/PageActivity.java
+++ b/app/src/main/java/org/wikipedia/page/PageActivity.java
@@ -958,7 +958,7 @@
             getSupportFragmentManager()
                     .beginTransaction()
                     .add(R.id.activity_page_container, fragment)
-                    .commit();
+                    .commitNowAllowingStateLoss();
         }
     }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/311628
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6ebdeea38b7925f230060f681828bea0cdcfb508
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <sniedziel...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to