我在LogCat窗口中收到此消息:
W / Surface:警告:Surface的mNativeObject(0xffffffffaebfa400)!= mLockedObject(0xffffffffaeca2c00)
这意味着什么?
更新 这是我用来锁定/解锁画布的代码
public void run() {
long startTime;
long drawTime;
//milliseconds per frame
long mspf = 1000 / FRAMES_PER_SECOND;
while (mRun) {
if (currentState != STATE_PAUSE) {
startTime = System.currentTimeMillis();
//draw to our canvas
Canvas c = null;
try {
c = mSurfaceHolder.lockCanvas(null);
if (c != null) {
drawAll(c);
}
} finally {
if (c != null) {
mSurfaceHolder.unlockCanvasAndPost(c);
}
}
//make the frame rate consistent
drawTime = (System.currentTimeMillis() - startTime);
if (drawTime <= mspf) {
try {
sleep(mspf - drawTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} else {
//have the thread wait to start again so we aren't doing busy work
try {
synchronized (mWaitLock) {
mWaitLock.wait();
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
答案 0 :(得分:1)
您可以看到生成消息here的代码。
这意味着原生表面指针在lockCanvas()
和unlockCanvasAndPost()
之间发生了变化。该邮件已添加到this change中,作为修复this bug的一部分。错误报告中有相当多的信息;它可以让您深入了解应用程序中导致这种情况的原因。