From b28a0e8ce95197e6e8985a1ad2cebe049b7f5cb9 Mon Sep 17 00:00:00 2001 From: ekager Date: Fri, 17 Apr 2020 19:13:43 -0700 Subject: [PATCH] [fenix] No issue: Fix leaking sessionControlInteractor --- app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt index 81787c7057..74efbf0b0c 100644 --- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -152,7 +152,10 @@ class HomeFragment : Fragment() { private lateinit var homeAppBarOffSetListener: AppBarLayout.OnOffsetChangedListener private val onboarding by lazy { FenixOnboarding(requireContext()) } private lateinit var homeFragmentStore: HomeFragmentStore - private lateinit var sessionControlInteractor: SessionControlInteractor + private var _sessionControlInteractor: SessionControlInteractor? = null + protected val sessionControlInteractor: SessionControlInteractor + get() = _sessionControlInteractor!! + private var sessionControlView: SessionControlView? = null private lateinit var currentMode: CurrentMode @@ -201,7 +204,7 @@ class HomeFragment : Fragment() { ) } - sessionControlInteractor = SessionControlInteractor( + _sessionControlInteractor = SessionControlInteractor( DefaultSessionControlController( store = requireComponents.core.store, activity = activity, @@ -356,6 +359,7 @@ class HomeFragment : Fragment() { override fun onDestroyView() { super.onDestroyView() + _sessionControlInteractor = null sessionControlView = null view!!.homeAppBar.removeOnOffsetChangedListener(homeAppBarOffSetListener) }