LemmyNet / jerboa

A native android app for Lemmy
GNU Affero General Public License v3.0
1.18k stars 170 forks source link

Crash when going back after clicking on a link in a preview in reply mode. #1115

Closed MV-GH closed 1 year ago

MV-GH commented 1 year ago

Jerboa Version

0.0.41

Android Version + Phone

N/A

Describe The Bug

Crash when going back after clicking on a link in a preview when writing a reply to a comment

To Reproduce

In the case of a crash or when relevant include the logs

logs FATAL EXCEPTION: main Process: com.jerboa, PID: 10311 java.lang.RuntimeException: Failed to invoke public com.jerboa.model.ReplyItem() with no args at androidx.compose.ui.platform.WeakCache.construct(Unknown Source:79) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(Unknown Source:15) at com.google.gson.Gson.fromJson(SourceFile:7) at com.google.gson.Gson.fromJson(Unknown Source:0) at com.jerboa.MainActivity$onCreate$1$3$9$20$invoke$$inlined$takeDepsFromRoot$1.invoke(Unknown Source:38) at androidx.compose.material.Strings$Companion.observe(Unknown Source:63) at androidx.compose.runtime.DerivedSnapshotState.currentRecord(Unknown Source:216) at androidx.compose.runtime.DerivedSnapshotState.getCurrentRecord(Unknown Source:15) at androidx.compose.runtime.CompositionImpl.recordReadOf(Unknown Source:80) at androidx.compose.runtime.Recomposer$effectJob$1$1.invoke(SourceFile:5) at androidx.compose.runtime.Recomposer$effectJob$1$1.invoke(SourceFile:2) at androidx.compose.runtime.DerivedSnapshotState.getValue(Unknown Source:12) at com.jerboa.MainActivity$onCreate$1$3$9$2.invoke(SourceFile:98) at com.jerboa.MainActivity$onCreate$1$3$9$2.invoke(SourceFile:9) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(SourceFile:10) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(SourceFile:15) at androidx.navigation.compose.NavHostKt$NavHost$14$1.invoke(SourceFile:115) at androidx.navigation.compose.NavHostKt$NavHost$14$1.invoke(SourceFile:23) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(SourceFile:7) at kotlin.TuplesKt.CompositionLocalProvider(Unknown Source:182) at androidx.compose.runtime.saveable.SaveableStateHolderImpl.SaveableStateProvider(Unknown Source:114) at okio._UtilKt.access$SaveableStateProvider(Unknown Source:59) at androidx.navigation.compose.NavBackStackEntryProviderKt$LocalOwnersProvider$1.invoke(SourceFile:3) at androidx.navigation.compose.NavBackStackEntryProviderKt$LocalOwnersProvider$1.invoke(SourceFile:1) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(SourceFile:7) at kotlin.TuplesKt.CompositionLocalProvider(Unknown Source:182) at okio._UtilKt.LocalOwnersProvider(Unknown Source:67) at com.jerboa.MainActivity$onCreate$1$3$9$20.invoke(SourceFile:21) at com.jerboa.MainActivity$onCreate$1$3$9$20.invoke(SourceFile:2) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(SourceFile:10) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(SourceFile:15) at com.jerboa.ui.components.login.LoginKt$InstancePicker$1$4.invoke(Unknown Source:306) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(SourceFile:3) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(SourceFile:11) at androidx.compose.material3.CardKt.AnimatedEnterExitImpl(Unknown Source:1787) at androidx.compose.material3.CardKt.AnimatedVisibility(SourceFile:1) at com.alorma.compose.settings.ui.SettingsListKt$SettingsList$4.invoke(SourceFile:72) at com.alorma.compose.settings.ui.SettingsListKt$SettingsList$4.invoke(SourceFile:5) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(SourceFile:7) at _COROUTINE._BOUNDARY.AnimatedContent(Unknown Source:1036) at androidx.navigation.compose.NavHostKt.NavHost(SourceFile:115) at androidx.navigation.compose.NavHostKt$NavHost$16.invoke(SourceFile:5) at androidx.navigation.compose.NavHostKt$NavHost$16.invoke(SourceFile:2) at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Unknown Source:284) at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Unknown Source:57) at androidx.compose.runtime.ComposerImpl.doCompose(Unknown Source:166) at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Unknown Source:35) at androidx.compose.runtime.CompositionImpl.recompose(Unknown Source:18) at androidx.compose.runtime.Recomposer.access$performRecompose(Unknown Source:95) at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Unknown Source:350) at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(Unknown Source:6) at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(Unknown Source:47) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1074) at android.view.Choreographer.doCallbacks(Choreographer.java:897) at android.view.Choreographer.doFrame(Choreographer.java:822) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1061) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:236) at android.app.ActivityThread.main(ActivityThread.java:8061) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967) Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@a7a782f, androidx.compose.ui.platform.MotionDurationScaleImpl@a1dae3c, StandaloneCoroutine{Cancelling}@821a7c5, AndroidUiDispatcher@ed0a51a] Caused by: java.lang.InstantiationException: Can't instantiate abstract class com.jerboa.model.ReplyItem at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at androidx.compose.ui.platform.WeakCache.construct(Unknown Source:15) ... 62 more
MV-GH commented 1 year ago

I think this is because of ConsumeReturn, when navigating back the parcelable is already consumed. It needs to stay on the route

MV-GH commented 1 year ago

Actually I can't even reproduce this anymore. I think this got fixed with #1061 As this stack traces contains gson stuff which got removed in that pr