Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b6b3218 authored by Robert Carr's avatar Robert Carr
Browse files

SurfaceControl: Allow calling destroy when mOwned is true

mOwned was just put in place to prevent the finalizer in SysUI
from destroying leashes, it was never meant to prevent explicit
calls to destroy. On another note we should probably remove destroy
or call it "release" but we can come back to that.

Change-Id: I72b0ab467105dc63094994de5482cec651fffaa3
Fixes: 113820778
Test: Builds
parent 44650259
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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