From d5cc09fb6c477176ae4dc672c45164946e1b1701 Mon Sep 17 00:00:00 2001 From: cztomczak Date: Mon, 11 Nov 2024 22:21:16 +0100 Subject: [PATCH] Fix exception when ending debugging app from within Visual Studio. --- logging.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/logging.cpp b/logging.cpp index 5d41283..bf1dbe5 100644 --- a/logging.cpp +++ b/logging.cpp @@ -11,7 +11,7 @@ #include "executable.h" #include "string_utils.h" -HANDLE g_logFileHandle = NULL; +HANDLE g_logFileHandle = nullptr; void InitializeLogging(bool show_console, std::string log_level, std::string log_file) { @@ -51,7 +51,7 @@ void InitializeLogging(bool show_console, std::string log_level, FILE_ATTRIBUTE_NORMAL, NULL); if (g_logFileHandle == INVALID_HANDLE_VALUE) { - g_logFileHandle = NULL; + g_logFileHandle = nullptr; LOGGER_ERROR << "Opening log file for appending failed"; return; } @@ -74,6 +74,8 @@ void InitializeLogging(bool show_console, std::string log_level, } void ShutdownLogging() { if (g_logFileHandle) { - CloseHandle(g_logFileHandle); + // Throws exception. CEF also has access to that file and it does something with the handle. + // CloseHandle(g_logFileHandle); + g_logFileHandle = nullptr; } }