Fix memory leaks found by LeakCanary
This commit is contained in:
@@ -77,4 +77,11 @@ class RecipesFragment : Fragment(R.layout.fragment_recipes) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
Timber.v("onDestroyView() called")
|
||||
// Prevent RV leaking through mObservers list in adapter
|
||||
binding.recipes.adapter = null
|
||||
}
|
||||
}
|
||||
@@ -51,4 +51,14 @@ class RecipeInfoFragment : BottomSheetDialogFragment() {
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog =
|
||||
BottomSheetDialog(requireContext(), R.style.NoShapeBottomSheetDialog)
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
Timber.v("onDestroyView() called")
|
||||
// Prevent RV leaking through mObservers list in adapter
|
||||
with(binding) {
|
||||
ingredientsList.adapter = null
|
||||
instructionsList.adapter = null
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user