LemmyNet / jerboa

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

Tapping twice quickly on any back btn will crash the app #1087

Open MV-GH opened 1 year ago

MV-GH commented 1 year ago

Jerboa Version

0.41

Android Version + Phone

n/a

Describe The Bug

If you press twice quickly on a back button it will crash the application.

This is because it tries to remove the same backstackentry twice. each back button in the header should encapsulate the action so that it can only run once. but it should still work to practically instantly press that button in different screen to go back.

To Reproduce

Open a post, press twice quickly on the back button in the action bar. before it gets to the previous destination.

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

LOGS FATAL EXCEPTION: main Process: com.jerboa, PID: 693 java.lang.IllegalArgumentException: No destination with route graph_root is on the NavController's back stack. The current destination is null at androidx.navigation.NavController.getBackStackEntry(SourceFile:18) at coil.util.-Logs.rootChannel(Unknown Source:41) at kotlin.ResultKt.HomeActivity(Unknown Source:288) at com.jerboa.ui.components.home.BottomNavActivityKt$BottomNavActivity$4$2$1$4.invoke(SourceFile:25) at com.jerboa.ui.components.home.BottomNavActivityKt$BottomNavActivity$4$2$1$4.invoke(SourceFile:3) 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:116) at androidx.navigation.compose.NavHostKt$NavHost$14$1.invoke(SourceFile:23) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(SourceFile:7) at kotlin.ResultKt.CompositionLocalProvider(Unknown Source:182) at androidx.compose.runtime.saveable.SaveableStateHolderImpl.SaveableStateProvider(Unknown Source:114) at okio._UtilKt.access$SaveableStateProvider(Unknown Source:60) 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.ResultKt.CompositionLocalProvider(Unknown Source:182) at okio._UtilKt.LocalOwnersProvider(Unknown Source:67) at com.jerboa.MainActivity$onCreate$1$3$9$20.invoke(SourceFile:20) at com.jerboa.MainActivity$onCreate$1$3$9$20.invoke(SourceFile:2) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(SourceFile:10) at com.jerboa.ui.theme.ThemeKt$JerboaTheme$1.invoke(SourceFile:82) at com.jerboa.ui.theme.ThemeKt$JerboaTheme$1.invoke(SourceFile:19) at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Unknown Source:284) at androidx.compose.runtime.ComposerImpl.skipToGroupEnd(Unknown Source:33) at _COROUTINE._BOUNDARY.AnimatedContent(Unknown Source:206) at androidx.navigation.compose.NavHostKt.NavHost(SourceFile:115) at androidx.navigation.compose.NavHostKt.NavHost(SourceFile:127) at com.jerboa.ui.components.home.BottomNavActivityKt$BottomNavActivity$4$2.invoke(Unknown Source:191) at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(SourceFile:3) at androidx.compose.foundation.CanvasKt$Canvas$1.invoke(SourceFile:213) at androidx.compose.foundation.CanvasKt$Canvas$1.invoke(SourceFile:14) 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)
dessalines commented 9 months ago

Can't repro

MV-GH commented 9 months ago

That's because for most of them we don't use the back action any more but navigateUp instead try on post creation screen. I could still reproduce it there

dessalines commented 9 months ago

Ah okay I do see it now.