Memory leaks: clean after Benoit's remarks

This commit is contained in:
ganfra 2020-06-12 09:58:45 +02:00
parent f8dca1237a
commit ff171a39c6
2 changed files with 6 additions and 2 deletions

View file

@ -27,13 +27,17 @@ private const val LAYOUT_MANAGER_STATE = "LAYOUT_MANAGER_STATE"
class LayoutManagerStateRestorer(layoutManager: RecyclerView.LayoutManager) : Restorable, DefaultListUpdateCallback {
var layoutManager: RecyclerView.LayoutManager? = null
private var layoutManager: RecyclerView.LayoutManager? = null
private var layoutManagerState = AtomicReference<Parcelable?>()
init {
this.layoutManager = layoutManager
}
fun clear() {
layoutManager = null
}
override fun onSaveInstanceState(outState: Bundle) {
val layoutManagerState = layoutManager?.onSaveInstanceState()
outState.putParcelable(LAYOUT_MANAGER_STATE, layoutManagerState)

View file

@ -127,7 +127,7 @@ class RoomListFragment @Inject constructor(
modelBuildListener = null
roomListView.cleanup()
roomController.listener = null
stateRestorer.layoutManager = null
stateRestorer.clear()
createChatFabMenu.listener = null
super.onDestroyView()
}