Fixed
Status Update
Comments
al...@google.com <al...@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
dz...@gmail.com <dz...@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>
ap...@google.com <ap...@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()
}
}
jb...@google.com <jb...@google.com>
jb...@google.com <jb...@google.com> #6
With 2.2.0-alpha04 (that use Main.immediate), the issue seems to be still there (I tested it by calling emitSource() twice, like your test case)
Description
Version used: 1.3.0-beta01
Devices/Android versions reproduced on:
OnePlus 8 (API30), OnePlus 2 (API23), Emulator (API30)
Repository:
Steps to reproduce: Select input field -> Click button to navigate to new fragment (via Navigation library) -> Check notification for LeakCanary message (After returning back via back button all objects are garbage collected, but if you close app via home button you will receive warning from LeakCanary).
Additional info: It seems like there is no such problem in alpha02 version