From 068a4255c131af08c2bdd1b72fc91989fe0e103b Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Tue, 14 May 2019 22:19:56 +0200 Subject: [PATCH] Do not deliver result if view is destroyed --- .../de/danoeh/antennapod/fragment/ChaptersFragment.java | 9 +++++++++ .../de/danoeh/antennapod/fragment/CoverFragment.java | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java index 998ff698e..c4b82459a 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java @@ -62,6 +62,15 @@ public class ChaptersFragment extends ListFragment { EventBus.getDefault().register(this); } + @Override + public void onDestroyView() { + super.onDestroyView(); + + if (disposable != null) { + disposable.dispose(); + } + } + @Override public void onStop() { super.onStop(); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java index 87d58b1ff..7bb9c60e4 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java @@ -115,4 +115,13 @@ public class CoverFragment extends Fragment { controller.release(); controller = null; } + + @Override + public void onDestroyView() { + super.onDestroyView(); + + if (disposable != null) { + disposable.dispose(); + } + } }