Fix backend Device leak in dawn_end2end_tests harness with the wire

Bug: dawn:158
Change-Id: I248ba66864d03c3366fc077fd89824a1233a230e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/7520
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2019-05-24 22:31:36 +00:00 committed by Commit Bot service account
parent f56efdf0d1
commit 8aa036e9e4
2 changed files with 10 additions and 2 deletions

View File

@ -203,6 +203,12 @@ DawnTest::~DawnTest() {
swapchain = dawn::SwapChain();
device = dawn::Device();
mWireClient = nullptr;
mWireServer = nullptr;
if (gTestEnv->UsesWire()) {
backendProcs.deviceRelease(backendDevice);
}
dawnSetProcs(nullptr);
}
@ -301,7 +307,6 @@ void DawnTest::SetUp() {
mPCIInfo = backendAdapter.GetPCIInfo();
DawnDevice backendDevice;
const char* forceEnabledWorkaround = GetParam().forceEnabledWorkaround;
if (forceEnabledWorkaround != nullptr) {
ASSERT(gTestEnv->GetInstance()->GetToggleInfo(forceEnabledWorkaround) != nullptr);
@ -311,7 +316,7 @@ void DawnTest::SetUp() {
backendDevice = backendAdapter.CreateDevice(nullptr);
}
DawnProcTable backendProcs = dawn_native::GetProcs();
backendProcs = dawn_native::GetProcs();
// Get the test window and create the device using it (esp. for OpenGL)
GLFWwindow* testWindow = gTestEnv->GetWindowForBackend(backendType);

View File

@ -157,6 +157,9 @@ class DawnTest : public ::testing::TestWithParam<DawnTestParam> {
dawn::Queue queue;
dawn::SwapChain swapchain;
DawnProcTable backendProcs = {};
DawnDevice backendDevice = nullptr;
// Helper methods to implement the EXPECT_ macros
std::ostringstream& AddBufferExpectation(const char* file,
int line,