From e95c62d74ab1423e59b5784e29fd6c494164e0cc Mon Sep 17 00:00:00 2001 From: John Reck Date: Tue, 18 Aug 2020 12:37:43 -0700 Subject: Fix crash regression when calling setSurface(null) Test: HardwareRendererTests#testSetNullSurface Fixes: 165335939 Change-Id: I8f93a0b6a115088af634e21e91b95b4f6a521f12 --- libs/hwui/renderthread/RenderProxy.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libs/hwui/renderthread/RenderProxy.cpp') diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp index aad0cca80cdc..b51f6dcfc66f 100644 --- a/libs/hwui/renderthread/RenderProxy.cpp +++ b/libs/hwui/renderthread/RenderProxy.cpp @@ -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); } }); } -- cgit v1.2.3