From 041aca1620e8f905df3342882af33618803b8a41 Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Mon, 25 Mar 2019 06:36:28 +0000 Subject: [PATCH] Fix leaking FenceCompletionUserdata in the wire This was being leaked if the completion status was not a success. Bug: chromium:939396 Change-Id: Ia09bcef935697b354e6e3da3c4a3d308545fec53 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5840 Commit-Queue: Corentin Wallez Reviewed-by: Kai Ninomiya Reviewed-by: Corentin Wallez --- src/dawn_wire/server/Server.h | 3 ++- src/dawn_wire/server/ServerFence.cpp | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/dawn_wire/server/Server.h b/src/dawn_wire/server/Server.h index 5f4dbbecbb..ac622ea954 100644 --- a/src/dawn_wire/server/Server.h +++ b/src/dawn_wire/server/Server.h @@ -68,7 +68,8 @@ namespace dawn_wire { namespace server { void* ptr, uint32_t dataLength, MapUserdata* userdata); - void OnFenceCompletedValueUpdated(FenceCompletionUserdata* userdata); + void OnFenceCompletedValueUpdated(DawnFenceCompletionStatus status, + FenceCompletionUserdata* userdata); #include "dawn_wire/server/ServerPrototypes_autogen.inl" diff --git a/src/dawn_wire/server/ServerFence.cpp b/src/dawn_wire/server/ServerFence.cpp index 96a78c6ac5..b52d3bd3bd 100644 --- a/src/dawn_wire/server/ServerFence.cpp +++ b/src/dawn_wire/server/ServerFence.cpp @@ -21,14 +21,17 @@ namespace dawn_wire { namespace server { void Server::ForwardFenceCompletedValue(DawnFenceCompletionStatus status, DawnCallbackUserdata userdata) { auto data = reinterpret_cast(static_cast(userdata)); - if (status == DAWN_FENCE_COMPLETION_STATUS_SUCCESS) { - data->server->OnFenceCompletedValueUpdated(data); - } + data->server->OnFenceCompletedValueUpdated(status, data); } - void Server::OnFenceCompletedValueUpdated(FenceCompletionUserdata* userdata) { + void Server::OnFenceCompletedValueUpdated(DawnFenceCompletionStatus status, + FenceCompletionUserdata* userdata) { std::unique_ptr data(userdata); + if (status != DAWN_FENCE_COMPLETION_STATUS_SUCCESS) { + return; + } + ReturnFenceUpdateCompletedValueCmd cmd; cmd.fence = data->fence; cmd.value = data->value;