Fixed
Status Update
Comments
il...@google.com <il...@google.com>
ap...@google.com <ap...@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
[Deleted User] <[Deleted User]> #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
Component used: Navigation Version used: 2.4.0-beta02 Devices/Android versions reproduced on: multiple versions
When using
fromSavedStateHandle
to create the NavArgs class, it succeeds on first passes, but it fails when it tries to restore the data from the saved state (after process-death) if it has anyParcelable[]
objects, as it doesn't cast them properly.To reproduce this, please use the attached project, and enable "don't keep activities" from the developer options, if you open the app, then navigate to another app, and comes back, the app will crash with the following stacktrace:
The generated
fromSavedStateHandle
from the attached project has this:while
fromBundle
handles the casting properly: