summaryrefslogtreecommitdiff
path: root/libs/gui/LayerState.cpp
diff options
context:
space:
mode:
author chaviw <chaviw@google.com> 2022-01-05 18:36:46 -0600
committer chaviw <chaviw@google.com> 2022-01-05 19:24:40 -0600
commit8dd181f3e8274bf89ebde94c1c7d57c9c83b0a49 (patch)
tree738f6dcff20f12f2a985e1811fe58515266e2627 /libs/gui/LayerState.cpp
parent38e78ac1e8d5006248f209fa7796faeea8feca66 (diff)
Replace releaseCallbackId with generateReleaseCallbackId in BufferData
releaseCallbackId was confusing data in BufferData because it wasn't being parceled, even though the rest of the object was. This is because the ReleaseCallbackId can be generated from info in BufferData. Therefore, remove releaseCallbackId and instead replace with a function that generates the ReleaseCallbackId This fixes an issue when Transactions that contained buffers for the same layer were being merged. The merge was expected to release the old buffer. However, if the Transaction was parceled before it was merged, the ReleaseCallbackId would be lost and the release callback would send an invalid callback id, resulting in a lost buffer that never got released. By using generateReleaseCallbackId, the callback id is recreated when the release callback needs to be invoked since the buffer and framenumber are already being parceled. Test: ReleaseBufferCallbackTest Test: AppConfigurationTests Bug: 209920544 Change-Id: I2a24b8a9764959173c960048dc82e68f4c083898
Diffstat (limited to 'libs/gui/LayerState.cpp')
-rw-r--r--libs/gui/LayerState.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index ec0573a1a9..acd9ac5a93 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -677,6 +677,10 @@ status_t LayerCaptureArgs::read(const Parcel& input) {
return NO_ERROR;
}
+ReleaseCallbackId BufferData::generateReleaseCallbackId() const {
+ return {buffer->getId(), frameNumber};
+}
+
status_t BufferData::write(Parcel& output) const {
SAFE_PARCEL(output.writeInt32, flags.get());