Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IllegalStateException after onSaveInstanceState #4549

Merged
merged 1 commit into from
Oct 23, 2020

Conversation

Stypox
Copy link
Member

@Stypox Stypox commented Oct 17, 2020

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

This PR fixes a random crash happening sometimes when messing with the miniplayer while it's still starting. According to this SO the solution is just to replace commit() with commitAllowingStateLoss(), which may not be a real solution (state loss should never happen in theory) but is surely better than making the app crash completely.

This was the stack trace:

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
        at androidx.fragment.app.FragmentManager.checkStateLoss(FragmentManager.java:1691)
        at androidx.fragment.app.FragmentManager.enqueueAction(FragmentManager.java:1731)
        at androidx.fragment.app.BackStackRecord.commitInternal(BackStackRecord.java:321)
        at androidx.fragment.app.BackStackRecord.commit(BackStackRecord.java:286)
        at org.schabi.newpipe.util.NavigationHelper.showMiniPlayer(NavigationHelper.java:409)
        at org.schabi.newpipe.MainActivity$3.onReceive(MainActivity.java:822)
        at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1218)
        at android.os.Handler.handleCallback(Handler.java:761) 
        at android.os.Handler.dispatchMessage(Handler.java:98) 
        at android.os.Looper.loop(Looper.java:156) 
        at android.app.ActivityThread.main(ActivityThread.java:6517) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832) 

APK testing

app-debug.zip

Due diligence

@opusforlife2 opusforlife2 added the bug Issue is related to a bug label Oct 17, 2020
Copy link
Member

@TobiGr TobiGr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@TobiGr TobiGr merged commit 90cb9d3 into TeamNewPipe:dev Oct 23, 2020
@Stypox Stypox deleted the fix-showMiniPlayer branch August 4, 2022 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants