diff options
Diffstat (limited to 'libs/ui/GraphicBuffer.cpp')
-rw-r--r-- | libs/ui/GraphicBuffer.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp index f800627ef7..637a9cf725 100644 --- a/libs/ui/GraphicBuffer.cpp +++ b/libs/ui/GraphicBuffer.cpp @@ -133,6 +133,9 @@ GraphicBuffer::~GraphicBuffer() if (handle) { free_handle(); } + for (auto& [callback, context] : mDeathCallbacks) { + callback(context, mId); + } } void GraphicBuffer::free_handle() @@ -534,6 +537,10 @@ status_t GraphicBuffer::unflatten( return NO_ERROR; } +void GraphicBuffer::addDeathCallback(GraphicBufferDeathCallback deathCallback, void* context) { + mDeathCallbacks.emplace_back(deathCallback, context); +} + #ifndef LIBUI_IN_VNDK bool GraphicBuffer::isBufferHubBuffer() const { return mBufferHubBuffer != nullptr; |