Status Update
Comments
jb...@google.com <jb...@google.com> #2
Could you please provide a minimal sample that reproduces this issue?
le...@gmail.com <le...@gmail.com> #3
Yes, of course
@Composable
private fun DemoNavHost() {
val controller = rememberNavController()
NavHost(
navController = controller,
startDestination = "mainRoute",
modifier = Modifier.fillMaxSize()
) {
composable("mainRoute") {
Surface() {
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Button(
onClick = {
controller.navigate("demoDialog")
controller.navigate("demoDialog") // Simulate a quick click by the user
}
) {
Text(text = "show dialog")
}
}
}
}
dialog("demoDialog") {
val context = LocalContext.current
val lifecycle = LocalLifecycleOwner.current
Surface() {
Column() {
Text(text = "I'm demo dialog")
Button(
onClick = {
Toast
.makeText(
context,
"${lifecycle.lifecycle.currentState}",
Toast.LENGTH_SHORT
)
.show()
}
) {
Text(text = "check lifecycle")
}
Button(onClick = controller::popBackStack) {
Text(text = "close")
}
}
}
}
}
}
Steps:
Step 1: Click the show dialog
button on mainRoute
Step 2: Because 2 pop-up windows pop up, we close the top one
Step 3: Click the check lifecycle
button on the pop-up window, you can see STARTED
instead of RESUMED
I have also checked the cause, which is consistent with the description in my question.
ch...@gmail.com <ch...@gmail.com> #4
In fact, I found another problem. When the tester frequently clicks the button, the button event is to display a Dialog
, Dialog
is set to be destroyed by external click, so Dialog
is always displayed and destroyed
Interesting thing, because it may be too fast, causing DialogHost
to not notice that Dialog
appears and disappears, but it has actually joined NavController#_visibleEntries
But because NavHost#DialogHost
did not process DisposableEffect
, it will not execute dialogNavigator#onTransitionComplete
, so it will not be removed from NavController#_visibleEntries
, and a NavBackStackEntry
leak occurs
The reason may be that the pop-up window appears and disappears within one frame
in...@gmail.com <in...@gmail.com> #5
Hi, can you please file a separate bug for the issue you see in
On initial bug - when multiple dialogs are open at the same time and the top one is dismissed, the second dialog in backstack is marked as transitioning to hold it in STARTED state until the top dialog has completed transitioning. But the second dialog was not marked as complete when composed so it stays in STARTED state instead of moving to expected RESUMED state.
vs...@google.com <vs...@google.com>
vs...@google.com <vs...@google.com> #6
Thank you for your answer, I will open a separate post to ask a separate question;
ra...@gmail.com <ra...@gmail.com> #7
Thanks for filing the new bug! I was thinking a separate bug for the issue you see in commment#4 with NavBackStackEntry
possibly leaking. I'm gonna update the new bug's description to match that.
pe...@gmail.com <pe...@gmail.com> #8
Fixed internally and will be available in navigation 2.7.2
.
sc...@gmail.com <sc...@gmail.com> #9
Branch: androidx-main
commit b624e50960eb6601efe2cd3f5d81b95a12ff56f2
Author: Clara Fok <clarafok@google.com>
Date: Thu Jun 22 14:11:43 2023
Fix Dialog not marked complete
When multiple dialogs are open at the same time and the top one is dismissed, the second dialog in backstack is marked as transitioning to hold it in STARTED state until the top dialog has completed transitioning. But the second dialog was never marked as complete so it stays in STARTED state instead of moving to expected RESUMED state.
Now we make sure to mark Dialogs as complete when Dialog has been commposed.
Test: ./gradlew navigation:navigation-compose:cC
Bug: 286371387
Change-Id: I48da82d4c0db3fecd40b4357b152e807078066c6
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/DialogNavigatorTest.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/DialogNavigator.kt
sy...@gmail.com <sy...@gmail.com> #10
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-compose:2.7.2
vs...@google.com <vs...@google.com> #11
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-compose:2.8.0-alpha01
al...@gmail.com <al...@gmail.com> #12
Please Fix.
Description
Pack 3) try to log anything and the LogCat window will remain totally blank
(even standard Android logs will not appear). You can also see it
explicitly fail on a manual log. First import:
import android.util.Log;
Then use it:
Log.v("tag", "something log worthy"); // v, d, w, i, e all fail
Nothing will appear.
A quick fix for this is to follow the same advice found for a different
problem here:
Which mostly consists of moving all the org.eclipse.mylyn.* files out of
the Eclipse plugin directory. After doing that and restarting Eclipse,
logging works as expected.