summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/RenderProxy.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2020-08-18 12:37:43 -0700
committerJohn Reck <jreck@google.com>2020-08-18 13:21:39 -0700
commite95c62d74ab1423e59b5784e29fd6c494164e0cc (patch)
treedfb390281fe852b21474dc4f9087755049814c27 /libs/hwui/renderthread/RenderProxy.cpp
parent408f136b477eda5a3a6e99295b66744633dd3c20 (diff)
Fix crash regression when calling setSurface(null)
Test: HardwareRendererTests#testSetNullSurface Fixes: 165335939 Change-Id: I8f93a0b6a115088af634e21e91b95b4f6a521f12
Diffstat (limited to 'libs/hwui/renderthread/RenderProxy.cpp')
-rw-r--r--libs/hwui/renderthread/RenderProxy.cpp4
1 files changed, 2 insertions, 2 deletions
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); }
});
}