LucasGGamerM / moshidon

Better modification of the official Mastodon for Android app
https://LucasGGamerM.github.io/moshidon/
GNU General Public License v3.0
632 stars 29 forks source link

App Crash when scrolling feed too quickly with Iceshrimp.NET instance #498

Open tamara-schmitz opened 2 months ago

tamara-schmitz commented 2 months ago

Describe the bug

The app hardcrashes, aka the window just disappears sometimes when scrolling too fast through a feed while the media has not loaded yet. It triggers more frequently in the media section of someone's profile. Sometimes this gets more sporadic with then attempting to navigate the app causing further crashes.

Further note: Iceshrimp.NET provides every picture as a WebP by default.

To reproduce

Steps to reproduce the behavior:

  1. Go to someone's profile
  2. Go to their media section
  3. Scroll fast enough
  4. See crash

Does this happen in the official app?

Does this issue also occur with the respective upstream release? No, not in v2.6.1 (112) from F-Droid.

Version

Moshidon version: v2.3.0+fork.105.moshinda (105) from F-Droid Android 14 Graphene OS Build Number 2024080200 with security hardening enabled.

Crash log

2.3.0+fork.105.moshinda (105)
2024-08-06T07:26:05.614Z

java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
at android.view.ViewGroup.addViewInner([ViewGroup.java:5295](http://viewgroup.java:5295/))
at android.view.ViewGroup.addView([ViewGroup.java:5124](http://viewgroup.java:5124/))
at android.view.ViewGroup.addView([ViewGroup.java:5064](http://viewgroup.java:5064/))
at android.view.ViewGroup.addView([ViewGroup.java:5036](http://viewgroup.java:5036/))
at [org.joinmastodon.android](http://org.joinmastodon.android/).ui.displayitems.MediaGridStatusDisplayItemHolder.onBind(MediaGridStatusDisplayItem.java:191)Holder.onBind([MediaGridStatusDisplayItem.java:103](http://mediagridstatusdisplayitem.java:103/))
at me.grishka.appkit.utils.BindableViewHolder.rebind([BindableViewHolder.java:47](http://bindableviewholder.java:47/))
at [org.joinmastodon.android](http://org.joinmastodon.android/).ui.displayitems.MediaGridStatusDisplayItemHolder.setImage(MediaGridStatusDisplayItem.java:258)RunnableTask2.run(ListImageLoader.java:285)[MethodAndArgsCaller.run](http://methodandargscaller.run/)([RuntimeInit.java:580](http://runtimeinit.java:580/))
at [com.android](http://com.android/).internal.os.ExecInit.main([ExecInit.java:50](http://execinit.java:50/))
at [com.android](http://com.android/).internal.os.RuntimeInit.nativeFinishInit(Native Method)
at [com.android](http://com.android/).internal.os.RuntimeInit.main([RuntimeInit.java:369](http://runtimeinit.java:369/))

Android Crash Log after relaunching the app.

type: crash
osVersion: google/lynx/lynx:14/AP2A.240705.004/2024080200:user/release-keys
package: org.joinmastodon.android.moshinda:105
process: org.joinmastodon.android.moshinda
processUptime: 114 + 258 ms
installer: com.android.packageinstaller

java.lang.RuntimeException: Unable to start activity ComponentInfo{org.joinmastodon.android.moshinda/org.joinmastodon.android.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'long me.grishka.appkit.imageloader.disklrucache.DiskLruCache.size()' on a null object reference
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4004)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4184)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:114)
    at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:231)
    at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:152)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:93)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2602)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loopOnce(Looper.java:232)
    at android.os.Looper.loop(Looper.java:317)
    at android.app.ActivityThread.main(ActivityThread.java:8623)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
    at com.android.internal.os.ExecInit.main(ExecInit.java:50)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:369)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'long me.grishka.appkit.imageloader.disklrucache.DiskLruCache.size()' on a null object reference
    at org.joinmastodon.android.fragments.settings.SettingsAboutAppFragment.updateMediaCacheItem(SettingsAboutAppFragment.java:150)
    at org.joinmastodon.android.fragments.settings.SettingsAboutAppFragment.onCreate(SettingsAboutAppFragment.java:88)
    at android.app.Fragment.performCreate(Fragment.java:2491)
    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1261)
    at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1581)
    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1642)
    at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3052)
    at android.app.FragmentManagerImpl.dispatchCreate(FragmentManager.java:2999)
    at android.app.FragmentController.dispatchCreate(FragmentController.java:174)
    at android.app.Activity.onCreate(Activity.java:1823)
    at me.grishka.appkit.FragmentStackActivity.onCreate(FragmentStackActivity.java:75)
    at org.joinmastodon.android.MainActivity.onCreate(MainActivity.java:62)
    at android.app.Activity.performCreate(Activity.java:9013)
    at android.app.Activity.performCreate(Activity.java:8991)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1531)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3986)
    ... 15 more
tamara-schmitz commented 2 months ago

Still experiencing a similar crash on v2.3.0+fork.107.moshinda (107) as can be seen in the first log in the first comment.

2.3.0+fork.107.moshinda (107)
2024-08-08T05:49:40.984Z

java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
    at android.view.ViewGroup.addViewInner(ViewGroup.java:5295)
    at android.view.ViewGroup.addView(ViewGroup.java:5124)
    at android.view.ViewGroup.addView(ViewGroup.java:5064)
    at android.view.ViewGroup.addView(ViewGroup.java:5036)
    at org.joinmastodon.android.ui.displayitems.MediaGridStatusDisplayItem$Holder.onBind(MediaGridStatusDisplayItem.java:191)
    at org.joinmastodon.android.ui.displayitems.MediaGridStatusDisplayItem$Holder.onBind(MediaGridStatusDisplayItem.java:103)
    at me.grishka.appkit.utils.BindableViewHolder.rebind(BindableViewHolder.java:47)
    at org.joinmastodon.android.ui.displayitems.MediaGridStatusDisplayItem$Holder.setImage(MediaGridStatusDisplayItem.java:258)
    at me.grishka.appkit.views.UsableRecyclerView.imageLoaded(UsableRecyclerView.java:289)
    at me.grishka.appkit.imageloader.ListImageLoader$RunnableTask$2.run(ListImageLoader.java:285)
    at android.os.Handler.handleCallback(Handler.java:959)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loopOnce(Looper.java:232)
    at android.os.Looper.loop(Looper.java:317)
    at android.app.ActivityThread.main(ActivityThread.java:8623)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
    at com.android.internal.os.ExecInit.main(ExecInit.java:50)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:369)
LucasGGamerM commented 2 months ago

Hopefully after finishing the upstream merging this will go away

tamara-schmitz commented 2 months ago

Hopefully after finishing the upstream merging this will go away

Will check again when you update it. Can you reproduce it?

LucasGGamerM commented 2 months ago

Hopefully after finishing the upstream merging this will go away

Will check again when you update it. Can you reproduce it?

No, which is why I am just praying it works again soon