Fix mFenceEvent HANDLE leak

dawn_native::d3d12::Device::mFenceEvent is created in Initialize
but is never closed.

Fix is to close in the destructor if it has been previously created.

Bug: dawn:215
Change-Id: Ie9e7a395fe6fe791e2581295ed12f20070671afa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10480
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Rafael Cintron 2019-08-23 22:41:48 +00:00 committed by Commit Bot service account
parent 3f21e11e24
commit 25cc723823
2 changed files with 5 additions and 1 deletions

View File

@ -120,6 +120,10 @@ namespace dawn_native { namespace d3d12 {
// Call Tick() again to clear them before releasing the allocator. // Call Tick() again to clear them before releasing the allocator.
mResourceAllocator->Tick(mCompletedSerial); mResourceAllocator->Tick(mCompletedSerial);
if (mFenceEvent != nullptr) {
::CloseHandle(mFenceEvent);
}
ASSERT(mUsedComObjectRefs.Empty()); ASSERT(mUsedComObjectRefs.Empty());
ASSERT(mPendingCommands.commandList == nullptr); ASSERT(mPendingCommands.commandList == nullptr);
} }

View File

@ -107,7 +107,7 @@ namespace dawn_native { namespace d3d12 {
Serial mCompletedSerial = 0; Serial mCompletedSerial = 0;
Serial mLastSubmittedSerial = 0; Serial mLastSubmittedSerial = 0;
ComPtr<ID3D12Fence> mFence; ComPtr<ID3D12Fence> mFence;
HANDLE mFenceEvent; HANDLE mFenceEvent = nullptr;
ComPtr<ID3D12Device> mD3d12Device; // Device is owned by adapter and will not be outlived. ComPtr<ID3D12Device> mD3d12Device; // Device is owned by adapter and will not be outlived.
ComPtr<ID3D12CommandQueue> mCommandQueue; ComPtr<ID3D12CommandQueue> mCommandQueue;