From 67737f1d4a6c9345c731551a4d8d5fc21475a050 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Fri, 7 Dec 2018 16:25:36 +0000 Subject: [PATCH] WireServer: Don't allow freeing the Device BUG=chromium:907278 BUG=chromium:911155 Change-Id: I6ec721b34b214bb242ac0d217e6ab12832c7323a Reviewed-on: https://dawn-review.googlesource.com/c/2842 Reviewed-by: Stephen White Reviewed-by: Austin Eng Commit-Queue: Corentin Wallez --- generator/templates/dawn_wire/WireServer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/generator/templates/dawn_wire/WireServer.cpp b/generator/templates/dawn_wire/WireServer.cpp index af34f6eb05..34a2daad8d 100644 --- a/generator/templates/dawn_wire/WireServer.cpp +++ b/generator/templates/dawn_wire/WireServer.cpp @@ -625,6 +625,12 @@ namespace dawn_wire { //* reference / release and only send destroy on refcount = 0. {% set Suffix = as_MethodSuffix(type.name, Name("destroy")) %} bool Handle{{Suffix}}(const char** commands, size_t* size) { + + //* Freeing the device has to be done out of band. + {% if type.name.canonical_case() == "device" %} + return false; + {% endif %} + const auto* cmd = GetCommand<{{Suffix}}Cmd>(commands, size); if (cmd == nullptr) { return false;