From 81793808b9347a52dd979e4b3d5d9d10fc8c4915 Mon Sep 17 00:00:00 2001 From: Anton Ivanov Date: Thu, 13 Feb 2025 22:57:24 -0800 Subject: Harden construction sites of android::StrongPointer. Bug: 393217449 Test: presubmit Flag: EXEMPT_refactor Change-Id: Icf703aed608531e9b302b299481af00a52074731 --- libs/gui/SurfaceControl.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'libs/gui/SurfaceControl.cpp') diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp index b735418d4b..ba2d80d1b3 100644 --- a/libs/gui/SurfaceControl.cpp +++ b/libs/gui/SurfaceControl.cpp @@ -269,10 +269,11 @@ status_t SurfaceControl::readFromParcel(const Parcel& parcel, SAFE_PARCEL(parcel.readUint32, &format); // We aren't the original owner of the surface. - *outSurfaceControl = new SurfaceControl(new SurfaceComposerClient( - interface_cast(client)), - handle.get(), layerId, layerName, width, height, format, - transformHint); + *outSurfaceControl = + sp::make(sp::make( + interface_cast(client)), + handle, layerId, layerName, width, height, format, + transformHint); return NO_ERROR; } @@ -303,7 +304,7 @@ sp SurfaceControl::getParentingLayer() { if (mBbqChild != nullptr) { return mBbqChild; } - return this; + return sp::fromExisting(this); } uint64_t SurfaceControl::resolveFrameNumber(const std::optional& frameNumber) { -- cgit v1.2.3-59-g8ed1b