summaryrefslogtreecommitdiff
path: root/libs/gui/SurfaceControl.cpp
diff options
context:
space:
mode:
author Rob Carr <racarr@google.com> 2019-02-07 20:45:11 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-02-07 20:45:11 +0000
commitb73e4954e3ae9b0828600f5a9ebbef5da963f13d (patch)
tree9efbd72513911e69ac44c5bde93de870b409e8cb /libs/gui/SurfaceControl.cpp
parent80c7d5a310375d98ded820273c808db1b0f3b76e (diff)
parent8b6b32182d1c4f37e00b2c539f2f81ef2c846e63 (diff)
Merge "SurfaceControl: Allow calling destroy when mOwned is true"
Diffstat (limited to 'libs/gui/SurfaceControl.cpp')
-rw-r--r--libs/gui/SurfaceControl.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp
index 008f520bb0..f06d36aea3 100644
--- a/libs/gui/SurfaceControl.cpp
+++ b/libs/gui/SurfaceControl.cpp
@@ -63,6 +63,8 @@ SurfaceControl::SurfaceControl(const sp<SurfaceControl>& other) {
SurfaceControl::~SurfaceControl()
{
+ // Avoid reparenting the server-side surface to null if we are not the owner of it,
+ // meaning that we retrieved it from another process.
if (mClient != nullptr && mHandle != nullptr && mOwned) {
SurfaceComposerClient::doDropReferenceTransaction(mHandle, mClient->getClient());
}
@@ -74,9 +76,7 @@ SurfaceControl::~SurfaceControl()
void SurfaceControl::destroy()
{
- // Avoid destroying the server-side surface if we are not the owner of it, meaning that we
- // retrieved it from another process.
- if (isValid() && mOwned) {
+ if (isValid()) {
SurfaceComposerClient::Transaction().reparent(this, nullptr).apply();
}
// clear all references and trigger an IPC now, to make sure things