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

Crash after NPE in AbstractBottomSheetFragment #2386

Closed
tapetis opened this issue Dec 18, 2020 · 1 comment
Closed

Crash after NPE in AbstractBottomSheetFragment #2386

tapetis opened this issue Dec 18, 2020 · 1 comment
Labels

Comments

@tapetis
Copy link
Contributor

tapetis commented Dec 18, 2020

My app crashed with the following stack trace:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: de.westnordost.streetcomplete, PID: 16629
    java.lang.NullPointerException: closeButton must not be null
        at de.westnordost.streetcomplete.quests.AbstractBottomSheetFragment.updateCloseButtonVisibility(AbstractBottomSheetFragment.kt:145)
        at de.westnordost.streetcomplete.quests.AbstractBottomSheetFragment.access$updateCloseButtonVisibility(AbstractBottomSheetFragment.kt:31)
        at de.westnordost.streetcomplete.quests.AbstractBottomSheetFragment$onViewCreated$5.onSlide(AbstractBottomSheetFragment.kt:94)
        at com.google.android.material.bottomsheet.BottomSheetBehavior.dispatchOnSlide(BottomSheetBehavior.java:1498)
        at com.google.android.material.bottomsheet.BottomSheetBehavior$4.onViewPositionChanged(BottomSheetBehavior.java:1365)
        at androidx.customview.widget.ViewDragHelper.continueSettling(ViewDragHelper.java:750)
        at com.google.android.material.bottomsheet.BottomSheetBehavior$SettleRunnable.run(BottomSheetBehavior.java:1537)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972)
        at android.view.Choreographer.doCallbacks(Choreographer.java:796)
        at android.view.Choreographer.doFrame(Choreographer.java:727)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7660)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

How to Reproduce
I am not able to reproduce this crash, but I think it happened after returning to the app from the background while a quest sheet was shown.

Versions affected
v28.0-beta2

@tapetis tapetis added the bug label Dec 18, 2020
@westnordost
Copy link
Member

I think this bug is not new, nothing changed there for quite some time.

I also think that your assumption is correct: It must have something to do when the app comes back from the background. In particular, what I think is going on is that the MainActivity is recreated but the callback for when the bottom sheet (the quest form) is sliding up or down is still being done on the old AbstractBottomSheetFragment that was part of the old MainActivity before it was recreated. Thus, AbstractBottomSheetFragment doesn't actually have a view attached anymore because the old view had been destroyed. So basically, this is a memory leak. That's my assumption at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants