From 335703b147746c6f46b3583d14d987643dc6f8dc Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Fri, 15 Apr 2016 15:56:51 +1000 Subject: [PATCH] debug: cache win32 error code before logging the code beneath LOG_WARNING and friends is opaque, and may accidentally replace the value of GetLastError before we have a chance to render it. --- debug_win32.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debug_win32.cpp b/debug_win32.cpp index 7afbd6a9..6a93a8d5 100644 --- a/debug_win32.cpp +++ b/debug_win32.cpp @@ -47,7 +47,8 @@ void prepare_debugger (void) { if (nullptr == LoadLibrary("exchndl.dll")) { - LOG_WARNING("Emergency debugger not loaded: %s", util::win32_error::code_string ()); + auto code = GetLastError (); + LOG_WARNING("Emergency debugger not loaded: %s", util::win32_error::code_string (code)); } }