[Android] [PATCH] Never load images via http from the main thread

Geoffrey Métais geoffrey at videolan.org
Tue Jun 13 10:10:43 CEST 2017


This is a method we ensure is not called in main thread. That's why we
didn't have any check.
We'd better use  @WorkerThread annotation imho.

Le lun. 12 juin 2017 à 22:07, Marc K <morckx at gmail.com> a écrit :

> ---
>  vlc-android/src/org/videolan/vlc/util/HttpImageLoader.java | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/vlc-android/src/org/videolan/vlc/util/HttpImageLoader.java
> b/vlc-android/src/org/videolan/vlc/util/HttpImageLoader.java
> index 25cf9e413..7870eaf7a 100644
> --- a/vlc-android/src/org/videolan/vlc/util/HttpImageLoader.java
> +++ b/vlc-android/src/org/videolan/vlc/util/HttpImageLoader.java
> @@ -109,7 +109,7 @@ public class HttpImageLoader implements Callbacks {
>      public static Bitmap downloadBitmap(String imageUrl) {
>          HttpURLConnection urlConnection = null;
>          Bitmap icon = getBitmapFromIconCache(imageUrl);
> -        if (icon != null)
> +        if (icon != null || Looper.getMainLooper().getThread() ==
> Thread.currentThread())
>              return icon;
>          try {
>              URL url = new URL(imageUrl);
> --
> 2.11.0
>
> _______________________________________________
> Android mailing list
> Android at videolan.org
> https://mailman.videolan.org/listinfo/android
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/android/attachments/20170613/8e37874c/attachment.html>


More information about the Android mailing list