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.
This commit is contained in:
Gavin Andresen 2013-12-10 11:34:28 +10:00
parent 955787f83f
commit 962b1cf441
1 changed files with 15 additions and 18 deletions

View File

@ -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, ...)
}
buffer.erase(0, line_start);
}
}
#endif
return ret;
}