-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NPE in run() method of GifImageView #45
Comments
I don't think it will fix the problem, but making the |
@ianjoneill How did you get around this? |
I never came up with a reliable test-case (I've only ever seen the crash once), but as I mentioned in my previous comment, I think marking the |
@ianjoneill Yes but after applying your fix, have you received this exception again? |
Unfortunately I never got around to trying it out. |
I've gotten around this by cleaning up directly in the thread where the run method is executing. There's not a good reason that I can see for the cleanup to happen in the main UI thread. I was able to easily produce this issue, by using gifImageView in a ViewPager, and cycling rapidly forward and backward. The problem is that since the cleanup happens in another thread, the initial condition:
does not actually trigger the break, but then the cleanup runs in another thread, and sets gifDecoder to null. I also remove the "tmpBitmap" variable as well, and replaced it with an inline anonymous runnable,
|
Just had a crash in our app due to an NPE in the
run()
method ofGifImageView
.Stack trace:
Having a look at the code, I think it's possible that this is a threading problem. I think it's possible to NPE if the following scenario occurs:
startAnimation()
is called, sorun()
is called in a new thread.run()
finds thatshouldClear
isfalse
.clear()
is called on the main thread, so thecleanupRunnable
is run almost immediately, settinggifDecoder
tonull
.gifDecoder.getFrameCount()
.This seems to be a similar issue to #5.
The text was updated successfully, but these errors were encountered: