Browse Source

Fix infinite loop with LogPrint on Windows

Running -printtodebugger -debug (or -debug=lock),
compiled with -DDEBUG_LOCKORDER would infinite loop
on Windows because every critical section lock/unlock
triggers a LogPrint.

Solution is to use the raw boost mutex instead of a CCriticalSection.
0.10
Gavin Andresen 11 years ago
parent
commit
962b1cf441
  1. 7
      src/util.cpp

7
src/util.cpp

@ -299,13 +299,11 @@ int LogPrint(const char* category, const char* pszFormat, ...) @@ -299,13 +299,11 @@ int LogPrint(const char* category, const char* pszFormat, ...)
#ifdef WIN32
if (fPrintToDebugger)
{
static CCriticalSection cs_OutputDebugStringF;
// accumulate and output a line at a time
{
LOCK(cs_OutputDebugStringF);
static std::string buffer;
boost::mutex::scoped_lock scoped_lock(*mutexDebugLog);
va_list arg_ptr;
va_start(arg_ptr, pszFormat);
buffer += vstrprintf(pszFormat, arg_ptr);
@ -320,7 +318,6 @@ int LogPrint(const char* category, const char* pszFormat, ...) @@ -320,7 +318,6 @@ int LogPrint(const char* category, const char* pszFormat, ...)
}
buffer.erase(0, line_start);
}
}
#endif
return ret;
}

Loading…
Cancel
Save