You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
进入页面调用setPathAync 加载网络PAG资源,弱网环境下快速退出页面或者removePagView ANR问题出现
进入页面调用setPathAync 加载网络PAG资源,弱网环境下快速退出页面或者removePagView 有概率导致导致ANR,问题发生在
PagImageView->onDetachedFromWindow->decoderInfo.reset()
原因分析:
1.decoderInfo.reset() 为同步方法
2.调用setPathAync 如果弱网环境或请求失败的场景下会回调到 onAnimationUpdate->flush()
3.flush方法此时会调用initDecoderInfo,initDecoderInfo使用了deocderInfo的对象锁,并且会重新从网络加载Pag资源导致deocderInfo对象锁长期持有
4.如果此时退出Activity或者removeView等操作导致PAGImageView的onDetachFromWindow回调,调用到第1步的 decoderInfo.reset(),此时decoderInfo被作为对象锁被initDecoderInfo所在线程持有,主线程的decoderInfo.reset()等待子线程的decoderinfo对象锁释放,此时容易ANR
Beta Was this translation helpful? Give feedback.
All reactions