墙纸因错误而崩溃-queueBuffer:将缓冲区排队到SurfaceTexture的错误 [英] Wallpaper crashes with error - queueBuffer: error queuing buffer to SurfaceTexture
问题描述
public void render(){
Canvas canvas = null;
try{
canvas = this._surfaceHolder.lockCanvas(null);
synchronized (this._surfaceHolder) {
this.onDraw(canvas);
}
}catch(Exception e){ Log.w("Surface holder ", e.toString());}
finally{
if(canvas != null){
this._surfaceHolder.unlockCanvasAndPost(canvas);
}
}
}
protected void onDraw(Canvas canvas) {
this.renderBackGround(canvas);
for (Renderable renderable : this._fishes) {
renderable.render(canvas);
}
};
由于以下错误而崩溃
06-07 19:49:09.143:E/SurfaceTextureClient(13629):queueBuffer:到SurfaceTexture -19的错误排队缓冲区
Crashes with the below error
06-07 19:49:09.143: E/SurfaceTextureClient(13629): queueBuffer: error queuing buffer to SurfaceTexture, -19
06-07 19:49:09.143:E/SurfaceTextureClient(13629):queueBuffer(handle = 0x1c1b30)失败(没有此类设备)06-07 19:49:09.143:W/dalvikvm(13629):threadid = 11:线程以未捕获的异常退出(group = 0x40c671f8)06-07 19:49:09.143:E/AndroidRuntime(13629):致命异常:线程692
06-07 19:49:09.143: E/SurfaceTextureClient(13629): queueBuffer (handle=0x1c1b30) failed (No such device) 06-07 19:49:09.143: W/dalvikvm(13629): threadid=11: thread exiting with uncaught exception (group=0x40c671f8) 06-07 19:49:09.143: E/AndroidRuntime(13629): FATAL EXCEPTION: Thread-692
06-07 19:49:09.143:E/AndroidRuntime(13629):java.lang.IllegalArgumentException
06-07 19:49:09.143: E/AndroidRuntime(13629): java.lang.IllegalArgumentException
06-07 19:49:09.143:E/AndroidRuntime(13629):位于android.view.Surface.unlockCanvasAndPost(本机方法)
06-07 19:49:09.143: E/AndroidRuntime(13629): at android.view.Surface.unlockCanvasAndPost(Native Method)
06-07 19:49:09.143:E/AndroidRuntime(13629):位于com.android.internal.view.BaseSurfaceHolder.unlockCanvasAndPost(BaseSurfaceHolder.java:215)
06-07 19:49:09.143: E/AndroidRuntime(13629): at com.android.internal.view.BaseSurfaceHolder.unlockCanvasAndPost(BaseSurfaceHolder.java:215)
预先感谢
推荐答案
通常是在动态壁纸选择器中旋转设备时发生的.我发现的唯一解决方案是捕获IllegalArgumentException并将其忽略.
This typically happens when you rotate the device in the live wallpaper picker. The only solution I've found is to catch the IllegalArgumentException and ignore it.
if (canvas != null) {
try {
holder.unlockCanvasAndPost(canvas);
} catch (IllegalArgumentException e) {
// Ignore weird bug when rotating in live wallpaper picker
}
}
这篇关于墙纸因错误而崩溃-queueBuffer:将缓冲区排队到SurfaceTexture的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!