[fenix] Issue https://github.com/mozilla-mobile/fenix/issues/4513: fix mismatched bookmark listener lifecycles

The mismatch here was creating potentially inconsistent states. When first put into a CREATED or STARTED state, the listener would not be active, however after going through onResume it would then stay active until destroyed.

We should only be navigating to bookmarks when in a RESUMED state, so this change should be safe. I tried it a few times to verify. But I've been wrong before!
pull/600/head
Severin Rudie 5 years ago committed by Emily Kager
parent 28d64cdd9e
commit e2b3b1bb6f

@ -23,7 +23,7 @@ class BookmarkDeselectNavigationListener(
navController.addOnDestinationChangedListener(this)
}
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
@OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
fun onDestroy() {
navController.removeOnDestinationChangedListener(this)
}

Loading…
Cancel
Save