Fixed
Status Update
Comments
il...@google.com <il...@google.com>
il...@google.com <il...@google.com> #2
Yigit, do you have time to fix it?
reemission of the same liveData is racy
reemission of the same liveData is racy
an...@gmail.com <an...@gmail.com> #3
yea i'll take it.
an...@gmail.com <an...@gmail.com> #4
Thanks for the detailed analysis. This may not be an issue anymore since we've started using Main.immediate there but I' not sure; I'll try to create a test case.
il...@google.com <il...@google.com> #5
just emitting same live data reproduces the issue.
@Test
fun raceTest() {
val subLiveData = MutableLiveData(1)
val subject = liveData(testScope.coroutineContext) {
emitSource(subLiveData)
emitSource(subLiveData) //crashes
}
subject.addObserver().apply {
testScope.advanceUntilIdle()
}
}
@Test
fun raceTest() {
val subLiveData = MutableLiveData(1)
val subject = liveData(testScope.coroutineContext) {
emitSource(subLiveData)
emitSource(subLiveData) //crashes
}
subject.addObserver().apply {
testScope.advanceUntilIdle()
}
}
Description
If I have an action that links from the subgraph to the download page that pops the subgraph then no crashes, but clicking the back button takes you back to the main screen, not "page 3" as is wanted.
If I don't pop the subgraph then it crashes both when I navigate to main, and when I hit the back button (the one on the device, not the toolbar). The toolbar back button takes you back to page3 (as expected).
Stack trace:
```
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.IllegalArgumentException: Navigator androidx.navigation.fragment.FragmentNavigator@ae77e1d8 reported navigation to unknown destination id com.example.myapplication:id/page3Fragment
at androidx.navigation.NavController$2.onNavigatorNavigated(NavController.java:98)
at androidx.navigation.Navigator.dispatchOnNavigatorNavigated(Navigator.java:176)
at androidx.navigation.fragment.FragmentNavigator$1.onBackStackChanged(FragmentNavigator.java:72)
at android.support.v4.app.FragmentManagerImpl.reportBackStackChanged(FragmentManager.java:2704)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2338)
at android.support.v4.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:854)
at android.support.v4.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:797)
at android.support.v4.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:844)
at android.support.v4.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:797)
at android.support.v4.app.FragmentActivity.onBackPressed(FragmentActivity.java:186)
at android.app.Activity.onKeyUp(Activity.java:2145)
at android.view.KeyEvent.dispatch(KeyEvent.java:2633)
at android.app.Activity.dispatchKeyEvent(Activity.java:2375)
at android.support.v7.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:534)
at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:58)
at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:316)
at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:58)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1847)
at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3701)
at android.view.ViewRootImpl.handleImeFinishedEvent(ViewRootImpl.java:3651)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:2818)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
```
Component used:
android.arch.navigation:navigation-fragment-ktx
Version used:
1.0.0-alpha01
Devices/Android versions reproduced on:
All tested
- Sample project to trigger the issue.
See attached
- A screen record or screenshots showing the issue (if UI related).