2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-17 15:26:23 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/14194 - avoid leak when opening the "Libraries that we use" screen

This commit is contained in:
Sören Hentzschel 2020-08-29 16:33:55 +02:00 committed by ekager
parent 1e79ff40dc
commit 7f6df6c146

View File

@ -41,7 +41,7 @@ class AboutFragment : Fragment(), AboutPageListener {
private lateinit var headerAppName: String private lateinit var headerAppName: String
private lateinit var appName: String private lateinit var appName: String
private val aboutPageAdapter: AboutPageAdapter = AboutPageAdapter(this) private var aboutPageAdapter: AboutPageAdapter? = AboutPageAdapter(this)
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, inflater: LayoutInflater,
@ -58,6 +58,10 @@ class AboutFragment : Fragment(), AboutPageListener {
} }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
if (aboutPageAdapter == null) {
aboutPageAdapter = AboutPageAdapter(this)
}
about_list.run { about_list.run {
adapter = aboutPageAdapter adapter = aboutPageAdapter
addItemDecoration( addItemDecoration(
@ -76,7 +80,12 @@ class AboutFragment : Fragment(), AboutPageListener {
) )
populateAboutHeader() populateAboutHeader()
aboutPageAdapter.submitList(populateAboutList()) aboutPageAdapter?.submitList(populateAboutList())
}
override fun onDestroyView() {
super.onDestroyView()
aboutPageAdapter = null
} }
private fun populateAboutHeader() { private fun populateAboutHeader() {