pashapm / libs-for-android

Automatically exported from code.google.com/p/libs-for-android
Apache License 2.0
0 stars 0 forks source link

ImageLoader.flushRequests sometimes throws NoSuchElementException #6

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I haven't managed to consistently reproduce this I'm afraid but here is the 
stack trace:

java.util.NoSuchElementException
at java.util.LinkedList.removeFirstImpl(LinkedList.java:690)
at java.util.LinkedList.removeFirst(LinkedList.java:677)
at java.util.LinkedList.poll(LinkedList.java:896)
at 
com.google.android.imageloader.ImageLoader.flushRequests(ImageLoader.java:384)
at 
com.google.android.imageloader.ImageLoader$ImageTask.onPostExecute(ImageLoader.j
ava:916)
at 
com.google.android.imageloader.ImageLoader$ImageTask.onPostExecute(ImageLoader.j
ava:859)
at android.os.AsyncTask.finish(AsyncTask.java:417)
at android.os.AsyncTask.access$300(AsyncTask.java:127)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)

Original issue reported on code.google.com by rupert.b...@guardian.co.uk on 14 Jun 2011 at 3:07

GoogleCodeExporter commented 9 years ago
Are you using ImageLoader from any threads other than the main thread?

Original comment by pbald...@google.com on 14 Jun 2011 at 3:17

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Yes I'm calling prefetch from an AsyncTask, is that what's causing the problem?

Original comment by rupert.b...@guardian.co.uk on 15 Jun 2011 at 10:30

GoogleCodeExporter commented 9 years ago
Yes, ImageLoader is only designed to be used from the main thread.  I'll either 
add support for multiple threads, or have the methods throw a runtime exception 
when they're invoked from a background thread.

Original comment by pbald...@google.com on 15 Jun 2011 at 5:16

GoogleCodeExporter commented 9 years ago

Original comment by pbald...@google.com on 15 Jun 2011 at 9:54