diff --git a/src/init.cpp b/src/init.cpp index 15ee267c04c4..2489ceb9224c 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -120,7 +120,7 @@ void StartShutdown() } bool ShutdownRequested() { - return fRequestShutdown; + return fRequestShutdown || fRestartRequested; } class CCoinsViewErrorCatcher : public CCoinsViewBacked @@ -149,6 +149,7 @@ static CCoinsViewErrorCatcher *pcoinscatcher = NULL; /** Preparing steps before shutting down or restarting the wallet */ void PrepareShutdown() { + fRequestShutdown = true; // Needed when we shutdown the wallet fRestartRequested = true; // Needed when we restart the wallet LogPrintf("%s: In progress...\n", __func__); static CCriticalSection cs_Shutdown; diff --git a/src/masternode.cpp b/src/masternode.cpp index fb98f4e2a520..d57f6420e8f0 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -191,6 +191,8 @@ uint256 CMasternode::CalculateScore(int mod, int64_t nBlockHeight) void CMasternode::Check() { + if(ShutdownRequested()) return; + //TODO: Random segfault with this line removed TRY_LOCK(cs_main, lockRecv); if(!lockRecv) return; diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 1ec9929d7112..6c473940c772 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -306,7 +306,9 @@ void OverviewPage::showOutOfSyncWarning(bool fShow) void OverviewPage::updateDarksendProgress() { - if(IsInitialBlockDownload()) return; + if(IsInitialBlockDownload() || ShutdownRequested()) return; + + if(!pwalletMain || !walletModel || !walletModel->getOptionsModel()) return; int64_t nBalance = pwalletMain->GetBalance(); QString strAmountAndRounds;