From 426be4d2261921576fd2e673e99d39885cfe87a1 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Mon, 27 Jul 2020 13:16:23 +0200 Subject: [PATCH] Dispose loaders before setting controller to null --- .../antennapod/fragment/ChaptersFragment.java | 9 ++------- .../danoeh/antennapod/fragment/CoverFragment.java | 13 ++++--------- .../fragment/ItemDescriptionFragment.java | 7 ++++--- 3 files changed, 10 insertions(+), 19 deletions(-) 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 6d693f6cb..48c25552f 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ChaptersFragment.java @@ -93,17 +93,12 @@ public class ChaptersFragment extends Fragment { } @Override - public void onDestroyView() { - super.onDestroyView(); + public void onStop() { + super.onStop(); if (disposable != null) { disposable.dispose(); } - } - - @Override - public void onStop() { - super.onStop(); controller.release(); controller = null; EventBus.getDefault().unregister(this); 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 4e8cfbf86..79f378249 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java @@ -128,6 +128,10 @@ public class CoverFragment extends Fragment { @Override public void onStop() { super.onStop(); + + if (disposable != null) { + disposable.dispose(); + } controller.release(); controller = null; EventBus.getDefault().unregister(this); @@ -203,15 +207,6 @@ public class CoverFragment extends Fragment { } } - @Override - public void onDestroyView() { - super.onDestroyView(); - - if (disposable != null) { - disposable.dispose(); - } - } - void onPlayPause() { if (controller == null) { return; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java index ec64fbda1..ed8697adb 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java @@ -66,9 +66,6 @@ public class ItemDescriptionFragment extends Fragment { public void onDestroy() { super.onDestroy(); Log.d(TAG, "Fragment destroyed"); - if (webViewLoader != null) { - webViewLoader.dispose(); - } if (webvDescription != null) { webvDescription.removeAllViews(); webvDescription.destroy(); @@ -168,6 +165,10 @@ public class ItemDescriptionFragment extends Fragment { @Override public void onStop() { super.onStop(); + + if (webViewLoader != null) { + webViewLoader.dispose(); + } controller.release(); controller = null; }