diff options
| author | Luke Dashjr <[email protected]> | 2012-10-09 23:17:49 +0000 |
|---|---|---|
| committer | Luke Dashjr <[email protected]> | 2012-10-09 23:17:49 +0000 |
| commit | 32419357747f9c13c9d934d50f7974387419c0ce (patch) | |
| tree | 53785410b9b4329f1243c2927b175920366442ce /src/util.cpp | |
| parent | Update gitignore and Makefiles for build.h move from src/ to src/obj (diff) | |
| parent | Merge branch '0.5.x' into 0.6.0.x (diff) | |
| download | discoin-32419357747f9c13c9d934d50f7974387419c0ce.tar.xz discoin-32419357747f9c13c9d934d50f7974387419c0ce.zip | |
Merge branch '0.6.0.x' into 0.6.x
Diffstat (limited to 'src/util.cpp')
| -rw-r--r-- | src/util.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/util.cpp b/src/util.cpp index 7ec2a82c6..8a2e0d65d 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -216,8 +216,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) |