diff options
Diffstat (limited to 'libs/gui/SurfaceControl.cpp')
-rw-r--r-- | libs/gui/SurfaceControl.cpp | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp index f06d36aea3..55488dad0b 100644 --- a/libs/gui/SurfaceControl.cpp +++ b/libs/gui/SurfaceControl.cpp @@ -68,10 +68,7 @@ SurfaceControl::~SurfaceControl() if (mClient != nullptr && mHandle != nullptr && mOwned) { SurfaceComposerClient::doDropReferenceTransaction(mHandle, mClient->getClient()); } - mClient.clear(); - mHandle.clear(); - mGraphicBufferProducer.clear(); - IPCThreadState::self()->flushCommands(); + release(); } void SurfaceControl::destroy() @@ -79,7 +76,12 @@ void SurfaceControl::destroy() if (isValid()) { SurfaceComposerClient::Transaction().reparent(this, nullptr).apply(); } - // clear all references and trigger an IPC now, to make sure things + release(); +} + +void SurfaceControl::release() +{ + // Trigger an IPC now, to make sure things // happen without delay, since these resources are quite heavy. mClient.clear(); mHandle.clear(); @@ -87,17 +89,6 @@ void SurfaceControl::destroy() IPCThreadState::self()->flushCommands(); } -void SurfaceControl::clear() -{ - // here, the window manager tells us explicitly that we should destroy - // the surface's resource. Soon after this call, it will also release - // its last reference (which will call the dtor); however, it is possible - // that a client living in the same process still holds references which - // would delay the call to the dtor -- that is why we need this explicit - // "clear()" call. - destroy(); -} - void SurfaceControl::disconnect() { if (mGraphicBufferProducer != nullptr) { mGraphicBufferProducer->disconnect( |