From a0d855663a07d1983f56cc4fb216231ff310995b Mon Sep 17 00:00:00 2001 From: Zac Sweers Date: Mon, 27 Nov 2017 03:44:21 -0800 Subject: [PATCH] Check if observer is disposed in lifecycle events --- .../android/lifecycle/LifecycleEventsObservable.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/android/autodispose-android-archcomponents/src/main/java/com/uber/autodispose/android/lifecycle/LifecycleEventsObservable.java b/android/autodispose-android-archcomponents/src/main/java/com/uber/autodispose/android/lifecycle/LifecycleEventsObservable.java index 0844b36c7..5d00eafe1 100644 --- a/android/autodispose-android-archcomponents/src/main/java/com/uber/autodispose/android/lifecycle/LifecycleEventsObservable.java +++ b/android/autodispose-android-archcomponents/src/main/java/com/uber/autodispose/android/lifecycle/LifecycleEventsObservable.java @@ -84,6 +84,9 @@ void backfillEvents() { return; } lifecycle.addObserver(archObserver); + if (archObserver.isDisposed()) { + lifecycle.removeObserver(archObserver); + } } static final class ArchLifecycleObserver extends MainThreadDisposable