ChromeLikeTabSwitcher: IndexOutOfBoundsException when calling getTab()

Steps to reproduce:

  1. Have 20+ tabs opened
  2. Scroll up to the top of tab list
  3. Click on the “x” button to close tab
  4. After closing ~10 tabs, try to scroll down.

Stacktrace:

java.lang.IndexOutOfBoundsException: Index: 15, Size: 8
	at java.util.ArrayList.get(ArrayList.java:437)
	at de.mrapp.android.tabswitcher.model.TabSwitcherModel.getTab(TabSwitcherModel.java:1158)
	at de.mrapp.android.tabswitcher.TabSwitcher.getTab(TabSwitcher.java:1482)
	at de.mrapp.android.tabswitcher.model.TabItem.create(TabItem.java:100)
	at de.mrapp.android.tabswitcher.iterator.ItemIterator.getItem(ItemIterator.java:134)
	at de.mrapp.android.tabswitcher.iterator.AbstractItemIterator.next(AbstractItemIterator.java:229)
	at de.mrapp.android.tabswitcher.layout.AbstractTabSwitcherLayout.calculatePositionsWhenDraggingToStart(AbstractTabSwitcherLayout.java:706)
	at de.mrapp.android.tabswitcher.layout.AbstractTabSwitcherLayout.onDrag(AbstractTabSwitcherLayout.java:1573)
	at de.mrapp.android.tabswitcher.layout.AbstractDragTabsEventHandler.notifyOnDrag(AbstractDragTabsEventHandler.java:342)
	at de.mrapp.android.tabswitcher.layout.AbstractDragTabsEventHandler.handleDrag(AbstractDragTabsEventHandler.java:675)
	at de.mrapp.android.tabswitcher.layout.AbstractDragTabsEventHandler.onDrag(AbstractDragTabsEventHandler.java:735)
	at de.mrapp.android.tabswitcher.gesture.AbstractTouchEventHandler.handleTouchEvent(AbstractTouchEventHandler.java:317)
	at de.mrapp.android.tabswitcher.gesture.TouchEventDispatcher.handleTouchEvent(TouchEventDispatcher.java:272)
	at de.mrapp.android.tabswitcher.TabSwitcher.onTouchEvent(TabSwitcher.java:1942)
	at android.view.View.dispatchTouchEvent(View.java:11722)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2955)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2636)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2961)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2650)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2961)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2650)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2961)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2650)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2961)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2650)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2961)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2650)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2961)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2650)
	at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:455)
	at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1828)
	at android.app.Activity.dispatchTouchEvent(Activity.java:3292)
	at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
	at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
	at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:417)
	at android.view.View.dispatchPointerEvent(View.java:11961)
	at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4790)
	at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4604)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4142)
	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4195)
	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4161)
	at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4288)
	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4169)
	at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4345)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4142)
	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4195)
	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4161)
	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4169)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4142)
	at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6663)
	at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6637)
	at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6598)
	at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6766)
	at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:186)
	at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
	at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:177)
	at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:6737)
	at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:6789)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:966)
	at android.view.Choreographer.doCallbacks(Choreographer.java:778)
	at android.view.Choreographer.doFrame(Choreographer.java:707)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:952)
	at android.os.Handler.handleCallback(Handler.java:789)
	at android.os.Handler.dispatchMessage(Handler.java:98)
	at android.os.Looper.loop(Looper.java:251)
	at android.app.ActivityThread.main(ActivityThread.java:6572)
	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)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (14 by maintainers)

Commits related to this issue

Most upvoted comments

OK! we have a much better minimal reproducible case (thanks @cooltey):

  • Scroll to the top of the tab list.
  • Start clicking the “x” button to close the tabs repeatedly, even while the previous tab is still animating away.
  • After a few tabs have animated away, scroll the list up.

https://youtu.be/0SimZWcE1O0

Okay, so the stacktraces are probably related to each other. I will investigate further and will see how to possibly fix this.

Wow, I wasn’t aware that this library is used in an app that popular. I will see, if I can make any guesses about what might go wrong in these cases by taking a deeper look at the code.

Thanks for reporting this issue. I just tried to reproduce the crash you have reported, but unfortunately I wasn’t able to do so. Do you know a way to reliably trigger the crash other than randomly removing/adding tabs and swiping around?