Fixed
Status Update
Comments
jb...@google.com <jb...@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
tp...@gmail.com <tp...@gmail.com> #3
yea i'll take it.
jb...@google.com <jb...@google.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
Component used: Fragment, ComponentDialog
Version used: 1.6.0
Devices/Android versions reproduced on:
After upgrading androidx.fragment to 1.6.0 from 1.5.5, I am unable to compile when attempting to subclass ComponentDialog. An error is generated that says:
If I convert
MyComponentDialog
to Java, it works as expected.I copied the source code for ComponentDialog and commented out the references to ViewTreeLifecycleOwner (since I don’t have access to that) and found the compiler generated the same error for ComponentDialog itself.
In ComponentDialog, if I replace:
with
the compiler no longer complains and the class can be extended.
The problem can be easily demonstrated with the following Kotlin code:
Other than converting
MyComponentDialog
to Java, I could not find a solution.