Fixed
Status Update
Comments
jb...@google.com <jb...@google.com>
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
ni...@gmail.com <ni...@gmail.com> #4
Comment has been deleted.
ni...@soprasteria.com <ni...@soprasteria.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: AndroidFragment
Version used: 1.8.2
Devices/Android versions reproduced on: Any (See attached image)
Reproduction :
Discussion We have no clue why it's triggered, anyway :
When we explore the source code of "Androidfragment", the usage of "commitNow" leads to the famous crash when application go to / come back from the background.
one of the explored solution today is to override this component and replace commitNow with the least unstable commitAllowingStateLoss.
Do you have any advice / opinion to this situation ?
Best Regards,
Nicolas V.