Fixed
Status Update
Comments
se...@google.com <se...@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
au...@gmail.com <au...@gmail.com> #3
yea i'll take it.
il...@google.com <il...@google.com>
ap...@google.com <ap...@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>
fa...@gmail.com <fa...@gmail.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()
}
}
ko...@gmail.com <ko...@gmail.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
Navigation
Version used:
1.0.0-alpha04
Devices/Android versions reproduced on:
All
Steps to reproduce:
- Create multiple fragments with separate Toolbars. Lets Say A and B
- Move from A -> B and use NavigationUI.setupWithNavController(fragmentBToolbar, nav)
- Go back to A. Layout of fragment B is leaked forever.
Problem:
With every call
navController.addOnNavigatedListener(new NavigationUI.ToolbarOnNavigatedListener(toolbar, drawerLayout));
new listener is added to navController with hard reference to Toolbar view. And ToolbarView has reference to its parent View (fragments View). And never cleared