michael-rapp / ChromeLikeTabSwitcher

Provides a tab switcher similar to the one, which is used in Google Chrome on Android
Apache License 2.0
1.23k stars 140 forks source link

Crash when fling-scrolling tabs and opening app switcher. #22

Closed dbrant closed 4 years ago

dbrant commented 5 years ago

This crash occurs when the user flings-to-scroll the list of tabs, and while the scrolling is still happening, invoke the system app switcher. It seems to occur consistently when flinging up so that the topmost tab comes into view.

I'm guessing it has to do with saving/restoring state (which is always tricky to do), especially while an animation is taking place.

Here's an example:

7f4fcd26eaeb

Stack trace:

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setCameraDistance(float)' on a null object reference
        at de.mrapp.android.tabswitcher.layout.phone.PhoneTabSwitcherLayout.tiltOnStartOvershoot(PhoneTabSwitcherLayout.java:2804)
        at de.mrapp.android.tabswitcher.layout.phone.PhoneTabSwitcherLayout.onTiltOnStartOvershoot(PhoneTabSwitcherLayout.java:3371)
        at de.mrapp.android.tabswitcher.layout.phone.PhoneDragTabsEventHandler.notifyOnTiltOnStartOvershoot(PhoneDragTabsEventHandler.java:137)
        at de.mrapp.android.tabswitcher.layout.phone.PhoneDragTabsEventHandler.onOvershootStart(PhoneDragTabsEventHandler.java:245)
        at de.mrapp.android.tabswitcher.layout.AbstractDragTabsEventHandler.handleDrag(AbstractDragTabsEventHandler.java:625)
        at de.mrapp.android.tabswitcher.layout.AbstractTabSwitcherLayout$FlingAnimation.applyTransformation(AbstractTabSwitcherLayout.java:367)
        at android.view.animation.Animation.getTransformation(Animation.java:879)
        at android.view.animation.Animation.getTransformation(Animation.java:953)
        at android.view.View.applyLegacyAnimation(View.java:18742)
        at android.view.View.draw(View.java:18858)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.updateDisplayListIfDirty(View.java:18133)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.updateDisplayListIfDirty(View.java:18133)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.updateDisplayListIfDirty(View.java:18133)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.updateDisplayListIfDirty(View.java:18133)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.updateDisplayListIfDirty(View.java:18133)
        at android.view.View.draw(View.java:18920)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4236)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4022)
        at android.view.View.draw(View.java:19195)
        at com.android.internal.policy.DecorView.draw(DecorView.java:788)
        at android.view.View.updateDisplayListIfDirty(View.java:18142)
        at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:669)
        at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:675)
        at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:783)
        at android.view.ViewRootImpl.draw(ViewRootImpl.java:2992)
        at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2806)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2359)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1392)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6752)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
        at android.view.Choreographer.doCallbacks(Choreographer.java:723)
        at android.view.Choreographer.doFrame(Choreographer.java:658)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
        at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
michael-rapp commented 5 years ago

I can confirm the issue. I was able to reproduce it.