aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/init.cpp9
-rw-r--r--src/main.cpp1
-rw-r--r--src/qt/optionsdialog.cpp2
-rw-r--r--src/util.cpp10
4 files changed, 19 insertions, 3 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 2141e196a0..e491652382 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -447,6 +447,7 @@ bool AppInit2()
FILE* file = fopen(pathLockFile.string().c_str(), "a"); // empty lock file; created if it doesn't exist.
if (file) fclose(file);
static boost::interprocess::file_lock lock(pathLockFile.string().c_str());
+ const char* pszDataDir = GetDataDir().string().c_str();
if (!lock.try_lock())
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. Bitcoin is probably already running."), pszDataDir));
@@ -630,6 +631,14 @@ bool AppInit2()
// ********************************************************* Step 7: load blockchain
+ if (!bitdb.Open(GetDataDir()))
+ {
+ string msg = strprintf(_("Error initializing database environment %s!"
+ " To recover, BACKUP THAT DIRECTORY, then remove"
+ " everything from it except for wallet.dat."), pszDataDir);
+ return InitError(msg);
+ }
+
if (GetBoolArg("-loadblockindextest"))
{
CTxDB txdb("r");
diff --git a/src/main.cpp b/src/main.cpp
index da1072970c..28bf01a8cb 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2513,6 +2513,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
// Ask the first connected node for block updates
static int nAskedForBlocks = 0;
if (!pfrom->fClient && !pfrom->fOneShot &&
+ (pfrom->nStartingHeight > (nBestHeight - 144)) &&
(pfrom->nVersion < NOBLKS_VERSION_START ||
pfrom->nVersion >= NOBLKS_VERSION_END) &&
(nAskedForBlocks < 1 || vNodes.size() <= 1))
diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp
index 8025126c25..3fb30a9518 100644
--- a/src/qt/optionsdialog.cpp
+++ b/src/qt/optionsdialog.cpp
@@ -139,7 +139,7 @@ void OptionsDialog::setMapper()
mapper->addMapping(ui->socksVersion, OptionsModel::ProxySocksVersion);
/* Window */
-#ifndef Q_WS_MAC
+#ifndef Q_OS_MAC
mapper->addMapping(ui->minimizeToTray, OptionsModel::MinimizeToTray);
mapper->addMapping(ui->minimizeOnClose, OptionsModel::MinimizeOnClose);
#endif
diff --git a/src/util.cpp b/src/util.cpp
index 296842acc3..8b08827d73 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -220,8 +220,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);
// reopen the log file, if requested
if (fReopenDebugLog) {