summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/CanvasContext.cpp
diff options
context:
space:
mode:
authorHuihong Luo <huisinro@google.com>2021-05-06 10:28:12 -0700
committerHuihong Luo <huisinro@google.com>2021-05-07 08:17:26 -0700
commite76f1813721c1087ac53bd5cbe854d412e21789e (patch)
tree57d86acf692d4d4c24e04309039f67a43ef02554 /libs/hwui/renderthread/CanvasContext.cpp
parent2c389bf6ef399733d3e4ae5cea397a66462ef8da (diff)
Fix leakage of ASurfaceTransactionCallback
The callback needs to set to null when thread renderer is destroyed. Bug: 187419942 Bug: 186869429 Test: blaze test --test_strategy=local --test_arg=--device_broker_type=LOCAL_ADB_SERVER //javatests/com/google/android/testing/elizabot/internal/sanity/subscriptionleak:SubscriptionLeakTest_generic_phone_google_31_x86 Change-Id: Ic80c58f102ee5f21830542030021828f6231cc37
Diffstat (limited to 'libs/hwui/renderthread/CanvasContext.cpp')
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index bba22071ecef..718887b6ff6e 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -195,6 +195,10 @@ void CanvasContext::setSurfaceControl(ASurfaceControl* surfaceControl) {
auto funcs = mRenderThread.getASurfaceControlFunctions();
+ if (surfaceControl == nullptr) {
+ setASurfaceTransactionCallback(nullptr);
+ }
+
if (mSurfaceControl != nullptr) {
funcs.unregisterListenerFunc(this, &onSurfaceStatsAvailable);
funcs.releaseFunc(mSurfaceControl);