aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2012-10-09 23:17:43 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2012-10-09 23:17:43 +0000
commit4cf9b4c6fad8e2ead715c5fbbfb023e05826a94d (patch)
treecf8d0b8d7abef0be531d4788b0653b1286136971 /src/util.cpp
parent638cecee77dba4bcffb225627f63658b247709ea (diff)
parentcef36fad891fba0fd8f5aec73bb17135b7fb133a (diff)
downloadbitcoin-4cf9b4c6fad8e2ead715c5fbbfb023e05826a94d.tar.xz
Merge branch '0.5.x' into 0.6.0.x
Conflicts: src/qt/transactiondesc.cpp
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/util.cpp b/src/util.cpp
index b5971ec724..9c12b15677 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -195,8 +195,14 @@ inline int OutputDebugStringF(const char* pszFormat, ...)
if (fileout)
{
static bool fStartedNewLine = true;
- static boost::mutex mutexDebugLog;
- boost::mutex::scoped_lock scoped_lock(mutexDebugLog);
+
+ // This routine may be called by global destructors during shutdown.
+ // Since the order of destruction of static/global objects is undefined,
+ // allocate mutexDebugLog on the heap the first time this routine
+ // is called to avoid crashes during shutdown.
+ static boost::mutex* mutexDebugLog = NULL;
+ if (mutexDebugLog == NULL) mutexDebugLog = new boost::mutex();
+ boost::mutex::scoped_lock scoped_lock(*mutexDebugLog);
// Debug print useful for profiling
if (fLogTimestamps && fStartedNewLine)