Skip to content

Commit

Permalink
Fix exception when ending debugging app from within Visual Studio.
Browse files Browse the repository at this point in the history
  • Loading branch information
cztomczak committed Nov 11, 2024
1 parent d940c58 commit d5cc09f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
}

0 comments on commit d5cc09f

Please sign in to comment.