diff --git a/src/dawn_native/d3d12/DeviceD3D12.cpp b/src/dawn_native/d3d12/DeviceD3D12.cpp index f49d843c99..a0318d85be 100644 --- a/src/dawn_native/d3d12/DeviceD3D12.cpp +++ b/src/dawn_native/d3d12/DeviceD3D12.cpp @@ -120,6 +120,10 @@ namespace dawn_native { namespace d3d12 { // Call Tick() again to clear them before releasing the allocator. mResourceAllocator->Tick(mCompletedSerial); + if (mFenceEvent != nullptr) { + ::CloseHandle(mFenceEvent); + } + ASSERT(mUsedComObjectRefs.Empty()); ASSERT(mPendingCommands.commandList == nullptr); } diff --git a/src/dawn_native/d3d12/DeviceD3D12.h b/src/dawn_native/d3d12/DeviceD3D12.h index 6af417accb..e45e8116be 100644 --- a/src/dawn_native/d3d12/DeviceD3D12.h +++ b/src/dawn_native/d3d12/DeviceD3D12.h @@ -107,7 +107,7 @@ namespace dawn_native { namespace d3d12 { Serial mCompletedSerial = 0; Serial mLastSubmittedSerial = 0; ComPtr mFence; - HANDLE mFenceEvent; + HANDLE mFenceEvent = nullptr; ComPtr mD3d12Device; // Device is owned by adapter and will not be outlived. ComPtr mCommandQueue;