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>
diff --git a/src/utils/WindowsDebugLogger.cpp b/src/utils/WindowsDebugLogger.cpp
index 76c9faa..d0030e2 100644
--- a/src/utils/WindowsDebugLogger.cpp
+++ b/src/utils/WindowsDebugLogger.cpp
@@ -82,6 +82,12 @@
}
~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);