do not sync thumbnail creation on cache. fixes #2283

This commit is contained in:
Daniel Gultsch 2017-02-09 14:32:50 +01:00
parent f60dd98d3c
commit c76b073b8e

View File

@ -60,6 +60,9 @@ import eu.siacs.conversations.utils.MimeUtils;
import eu.siacs.conversations.xmpp.pep.Avatar; import eu.siacs.conversations.xmpp.pep.Avatar;
public class FileBackend { 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 SimpleDateFormat IMAGE_DATE_FORMAT = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US);
private static final String FILE_PROVIDER = ".files"; private static final String FILE_PROVIDER = ".files";
@ -400,7 +403,7 @@ public class FileBackend {
final LruCache<String,Bitmap> cache = mXmppConnectionService.getBitmapCache(); final LruCache<String,Bitmap> cache = mXmppConnectionService.getBitmapCache();
Bitmap thumbnail = cache.get(uuid); Bitmap thumbnail = cache.get(uuid);
if ((thumbnail == null) && (!cacheOnly)) { if ((thumbnail == null) && (!cacheOnly)) {
synchronized (cache) { synchronized (THUMBNAIL_LOCK) {
thumbnail = cache.get(uuid); thumbnail = cache.get(uuid);
if (thumbnail != null) { if (thumbnail != null) {
return thumbnail; return thumbnail;