From 0277b94b374a6823e1b730bb63a8677c0c018bd9 Mon Sep 17 00:00:00 2001 From: Stypox Date: Wed, 24 Mar 2021 09:27:17 +0100 Subject: [PATCH] Fix error panel created in onViewCreated() but disposed in onDestroy() --- .../newpipe/fragments/BaseStateFragment.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/BaseStateFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/BaseStateFragment.java index 0de3ea012..db91755df 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/BaseStateFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/BaseStateFragment.java @@ -56,12 +56,6 @@ public abstract class BaseStateFragment extends BaseFragment implements ViewC } } - @Override - public void onDestroy() { - super.onDestroy(); - errorPanelHelper.dispose(); - } - /*////////////////////////////////////////////////////////////////////////// // Init //////////////////////////////////////////////////////////////////////////*/ @@ -74,6 +68,14 @@ public abstract class BaseStateFragment extends BaseFragment implements ViewC errorPanelHelper = new ErrorPanelHelper(this, rootView, this::onRetryButtonClicked); } + @Override + public void onDestroyView() { + super.onDestroyView(); + if (errorPanelHelper != null) { + errorPanelHelper.dispose(); + } + } + protected void onRetryButtonClicked() { reloadContent(); }