sk22 / megalodon

Pink modification of the official Mastodon for Android app
https://sk22.github.io/megalodon
GNU General Public License v3.0
544 stars 36 forks source link

Compose crashes during hashtag selection #937

Open jilldelong opened 7 months ago

jilldelong commented 7 months ago

Describe the bug

When composing a post and adding a hashtag, sometimes selecting a hashtag from the list causes the app to crash and also lose the unsaved post.

To reproduce It does not always happen and it isn't certain hashtags. If I start typing in a hashtag, at the bottom of the editor a list of matching hashtags comes up. Sometimes when I click on one, the app crashes.

Does this happen in the official app?

No

Version

Megalodon version: 2.1.6+fork.110

Crash log 2.1.6+fork.110 (110) 2023-11-19T20:17:48.914Z

java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 4(offset:4).state:16 me.grishka.appkit.views.UsableRecyclerView{27e0caa VFED..... ........ 0,0-1080,168}, adapter:org.joinmastodon.android.ui.viewcontrollers.ComposeAutocompleteViewController$HashtagsAdapter@25e4bf3, layout:androidx.recyclerview.widget.LinearLayoutManager@e3c90b0, context:org.joinmastodon.android.MainActivity@bff6b29 at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(SourceFile:6367) at androidx.recyclerview.widget.GapWorker.prefetchPositionWithDeadline(SourceFile:287) at androidx.recyclerview.widget.GapWorker.flushTaskWithDeadline(SourceFile:344) at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(SourceFile:360) at androidx.recyclerview.widget.GapWorker.prefetch(SourceFile:367) at androidx.recyclerview.widget.GapWorker.run(SourceFile:398) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8810) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

mdtdev commented 4 months ago

This has been a recurring problem for me, for months now, and I have to give it the exact same description as above. It doesn't do it every time I select a hashtag recommendation, but it probably does it on the order of one out of seven or eight times.

It has officially made the app completely unusable for me. (I can't imagine this is related to the bug but it does seem to happen more often with a much longer post than a shorter one.)

Here is my most recent crash log for the same thing:

2.1.6+fork.110 (110)
2024-02-15T15:31:41.833Z

java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionHashtagViewHolder{a23a106 position=1 id=-1, oldPos=-1, pLpos:-1 no parent} me.grishka.appkit.views.UsableRecyclerView{6b09f3 VFED..... ........ 0,0-1080,168}, adapter:org.joinmastodon.android.ui.viewcontrollers.ComposeAutocompleteViewController$HashtagsAdapter@3ca0bec, layout:androidx.recyclerview.widget.LinearLayoutManager@1312bb5, context:org.joinmastodon.android.MainActivity@3ef24a
    at androidx.recyclerview.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(SourceFile:6159)
    at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(SourceFile:6342)
    at androidx.recyclerview.widget.GapWorker.prefetchPositionWithDeadline(SourceFile:287)
    at androidx.recyclerview.widget.GapWorker.flushTaskWithDeadline(SourceFile:344)
    at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(SourceFile:360)
    at androidx.recyclerview.widget.GapWorker.prefetch(SourceFile:367)
    at androidx.recyclerview.widget.GapWorker.run(SourceFile:398)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:226)
    at android.os.Looper.loop(Looper.java:313)
    at android.app.ActivityThread.main(ActivityThread.java:8663)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)