Fix crash regression when calling setSurface(null)
Test: HardwareRendererTests#testSetNullSurface Fixes: 165335939 Change-Id: I8f93a0b6a115088af634e21e91b95b4f6a521f12
This commit is contained in:
@@ -184,7 +184,9 @@ static void android_view_ThreadedRenderer_setSurface(JNIEnv* env, jobject clazz,
|
||||
proxy->setSwapBehavior(SwapBehavior::kSwap_discardBuffer);
|
||||
}
|
||||
proxy->setSurface(window, enableTimeout);
|
||||
ANativeWindow_release(window);
|
||||
if (window) {
|
||||
ANativeWindow_release(window);
|
||||
}
|
||||
}
|
||||
|
||||
static jboolean android_view_ThreadedRenderer_pause(JNIEnv* env, jobject clazz,
|
||||
|
||||
@@ -77,10 +77,10 @@ void RenderProxy::setName(const char* name) {
|
||||
}
|
||||
|
||||
void RenderProxy::setSurface(ANativeWindow* window, bool enableTimeout) {
|
||||
ANativeWindow_acquire(window);
|
||||
if (window) { ANativeWindow_acquire(window); }
|
||||
mRenderThread.queue().post([this, win = window, enableTimeout]() mutable {
|
||||
mContext->setSurface(win, enableTimeout);
|
||||
ANativeWindow_release(win);
|
||||
if (win) { ANativeWindow_release(win); }
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user