mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
ThumbnailsCacheManager: null out cache when clearing it
Cache is closed when clearing, so it becomes unusable. This way ThumbnailsCacheManager will work as expected Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
06ddf3ec4d
commit
787804d20b
1 changed files with 3 additions and 3 deletions
|
@ -77,11 +77,10 @@ import java.io.InputStream;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.VisibleForTesting;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.annotation.VisibleForTesting;
|
||||||
import androidx.core.content.res.ResourcesCompat;
|
import androidx.core.content.res.ResourcesCompat;
|
||||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
|
|
||||||
|
@ -152,7 +151,7 @@ public final class ThumbnailsCacheManager {
|
||||||
mThumbnailCache = new DiskLruImageCache(diskCacheDir, DISK_CACHE_SIZE, mCompressFormat,
|
mThumbnailCache = new DiskLruImageCache(diskCacheDir, DISK_CACHE_SIZE, mCompressFormat,
|
||||||
mCompressQuality);
|
mCompressQuality);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log_OC.d(TAG, String.format(Locale.US, "Disk cache init failed: %s", e.getMessage()));
|
Log_OC.d(TAG, "Disk cache init failed", e);
|
||||||
mThumbnailCache = null;
|
mThumbnailCache = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1378,6 +1377,7 @@ public final class ThumbnailsCacheManager {
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public static void clearCache() {
|
public static void clearCache() {
|
||||||
mThumbnailCache.clearCache();
|
mThumbnailCache.clearCache();
|
||||||
|
mThumbnailCache = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Bitmap doResizedImageInBackground(OCFile file, FileDataStorageManager storageManager) {
|
private static Bitmap doResizedImageInBackground(OCFile file, FileDataStorageManager storageManager) {
|
||||||
|
|
Loading…
Reference in a new issue