From c76b073b8e37d52482574f94df491b248ca807dd Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 9 Feb 2017 14:32:50 +0100 Subject: [PATCH] do not sync thumbnail creation on cache. fixes #2283 --- .../java/eu/siacs/conversations/persistance/FileBackend.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index bfc4f6044..51dc53b2c 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -60,6 +60,9 @@ import eu.siacs.conversations.utils.MimeUtils; import eu.siacs.conversations.xmpp.pep.Avatar; public class FileBackend { + + private static final Object THUMBNAIL_LOCK = new Object(); + private static final SimpleDateFormat IMAGE_DATE_FORMAT = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US); private static final String FILE_PROVIDER = ".files"; @@ -400,7 +403,7 @@ public class FileBackend { final LruCache cache = mXmppConnectionService.getBitmapCache(); Bitmap thumbnail = cache.get(uuid); if ((thumbnail == null) && (!cacheOnly)) { - synchronized (cache) { + synchronized (THUMBNAIL_LOCK) { thumbnail = cache.get(uuid); if (thumbnail != null) { return thumbnail;