From 96472a533aaaf53cabf497b0c199579710612b5c Mon Sep 17 00:00:00 2001 From: Severin Rudie Date: Tue, 24 Sep 2019 16:43:11 -0700 Subject: [PATCH] Issue #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! --- .../library/bookmarks/BookmarkDeselectNavigationListener.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkDeselectNavigationListener.kt b/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkDeselectNavigationListener.kt index fabc8b5b5..758260446 100644 --- a/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkDeselectNavigationListener.kt +++ b/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkDeselectNavigationListener.kt @@ -23,7 +23,7 @@ class BookmarkDeselectNavigationListener( navController.addOnDestinationChangedListener(this) } - @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY) + @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE) fun onDestroy() { navController.removeOnDestinationChangedListener(this) }