From 3a913456e55ede882877107bf7fe2cc19fd92123 Mon Sep 17 00:00:00 2001 From: Mattia Iavarone Date: Mon, 4 Mar 2019 20:52:21 +0100 Subject: [PATCH] Fix more leaks --- library/src/main/kotlin/com/otaliastudios/elements/Adapter.kt | 1 + .../otaliastudios/elements/extensions/DataBindingPresenter.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/library/src/main/kotlin/com/otaliastudios/elements/Adapter.kt b/library/src/main/kotlin/com/otaliastudios/elements/Adapter.kt index cd09b6e..2efed20 100644 --- a/library/src/main/kotlin/com/otaliastudios/elements/Adapter.kt +++ b/library/src/main/kotlin/com/otaliastudios/elements/Adapter.kt @@ -276,6 +276,7 @@ public final class Adapter private constructor( it.unbind(this) } recyclerViews.clear() + lifecycle.removeObserver(this) } /** diff --git a/library/src/main/kotlin/com/otaliastudios/elements/extensions/DataBindingPresenter.kt b/library/src/main/kotlin/com/otaliastudios/elements/extensions/DataBindingPresenter.kt index 0999f5a..bdbb1ec 100644 --- a/library/src/main/kotlin/com/otaliastudios/elements/extensions/DataBindingPresenter.kt +++ b/library/src/main/kotlin/com/otaliastudios/elements/extensions/DataBindingPresenter.kt @@ -33,6 +33,7 @@ abstract class DataBindingPresenter( @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY) fun onDestroy() { binding.setLifecycleOwner(null) + lifecycle.removeObserver(this) } }) return holder