Skip to content
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

WebpDecoder 多线程问题 #97

Open
Linda0509 opened this issue Aug 5, 2022 · 1 comment
Open

WebpDecoder 多线程问题 #97

Linda0509 opened this issue Aug 5, 2022 · 1 comment

Comments

@Linda0509
Copy link

WebpDecoder.java :

entryRemoved 回调里 mBitmapProvider.release(oldValue); 最终会调用bitmap.recycle()

prepareCanvasWithBlending 方法里
Bitmap bitmap = mFrameBitmapCache.get(index);
if (bitmap != null && !bitmap.isRecycled()) {
canvas.drawBitmap(bitmap, 0, 0, null);
}
canvas.drawBitmap 的 bitmap 可能在判断isRecycled后 被另一个线程立刻调用bitmap.recycle() 实际调用drawBitmap时被recycled的bitmap最终将导致崩溃:Error, cannot access an invalid/free'd bitmap here

@zjupure
Copy link
Owner

zjupure commented Aug 14, 2022

getNextFrame()应该是由glide框架在同一个线程里驱动的,mFrameBitmapCache里Bitmap不会被上层业务和glide持有,为什么会出现多线程问题?你这个case是怎么使用的,直接调用了WebpDecoder的API?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants