Fix ASSERT in WindowsDebugLogger again

If debugger was already attached, closing
the exit handle would incorrectly assert.

Bug: None
Change-Id: I322591c66a9885a260a87750e066ba2e9d07fe23
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28321
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Bryan Bernhart 2020-09-10 15:53:47 +00:00 committed by Commit Bot service account
parent 498d5ea20a
commit 9427c97d9c
1 changed files with 6 additions and 0 deletions

View File

@ -82,6 +82,12 @@ namespace utils {
}
~WindowsDebugLogger() override {
if (IsDebuggerPresent()) {
// This condition is true when running inside Visual Studio or some other debugger.
// Messages are already printed there so we don't need to do anything.
return;
}
if (mShouldExitHandle != nullptr) {
ASSERT(SetEvent(mShouldExitHandle) != 0);
CloseHandle(mShouldExitHandle);