Merge pull request #4325 from ByteHamster/dispose-loader-before-null

Dispose loaders before setting controller to null
This commit is contained in:
H. Lehmann 2020-07-31 23:01:18 +02:00 committed by GitHub
commit de70873e96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 19 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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;
}