From be45f52f7e7900b5f6554df7dc291f1cb0762025 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Mon, 20 Jul 2020 12:12:38 -0400 Subject: [PATCH] oops --- .../instagrabber/activities/ProfileViewer.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/activities/ProfileViewer.java b/app/src/main/java/awais/instagrabber/activities/ProfileViewer.java index c4ae00d6..bd5d3398 100755 --- a/app/src/main/java/awais/instagrabber/activities/ProfileViewer.java +++ b/app/src/main/java/awais/instagrabber/activities/ProfileViewer.java @@ -7,6 +7,7 @@ import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.os.Bundle; import android.os.Environment; +import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; @@ -51,6 +52,7 @@ public final class ProfileViewer extends BaseLanguageActivity { private FetchListener fetchListener; private boolean errorHandled = false; private boolean fallbackToProfile = false; + private boolean destroyed = false; @Override protected void onCreate(@Nullable final Bundle savedInstanceState) { @@ -96,9 +98,9 @@ public final class ProfileViewer extends BaseLanguageActivity { if (errorHandled && fallbackToProfile || Utils.isEmpty(profilePicUrl)) profilePicUrl = profileModel.getHdProfilePic(); - final RequestManager glideRequestManager = Glide.with(this); + if (destroyed == true) return; - if (glideRequestManager == null) return; + final RequestManager glideRequestManager = Glide.with(this); glideRequestManager.load(profilePicUrl).addListener(new RequestListener() { @Override @@ -189,6 +191,13 @@ public final class ProfileViewer extends BaseLanguageActivity { else if (error == 2) Toast.makeText(this, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show(); } + @Override + protected void onDestroy() { + super.onDestroy(); + getDelegate().onDestroy(); + destroyed = true; + } + @Override public boolean onCreateOptionsMenu(final Menu menu) { getMenuInflater().inflate(R.menu.menu, menu);