fix 2 crashes

This commit is contained in:
UdjinM6 2015-07-03 01:09:14 +03:00
parent d39815db32
commit 189e48328d
3 changed files with 7 additions and 2 deletions

View File

@ -120,7 +120,7 @@ void StartShutdown()
} }
bool ShutdownRequested() bool ShutdownRequested()
{ {
return fRequestShutdown; return fRequestShutdown || fRestartRequested;
} }
class CCoinsViewErrorCatcher : public CCoinsViewBacked class CCoinsViewErrorCatcher : public CCoinsViewBacked
@ -149,6 +149,7 @@ static CCoinsViewErrorCatcher *pcoinscatcher = NULL;
/** Preparing steps before shutting down or restarting the wallet */ /** Preparing steps before shutting down or restarting the wallet */
void PrepareShutdown() void PrepareShutdown()
{ {
fRequestShutdown = true; // Needed when we shutdown the wallet
fRestartRequested = true; // Needed when we restart the wallet fRestartRequested = true; // Needed when we restart the wallet
LogPrintf("%s: In progress...\n", __func__); LogPrintf("%s: In progress...\n", __func__);
static CCriticalSection cs_Shutdown; static CCriticalSection cs_Shutdown;

View File

@ -191,6 +191,8 @@ uint256 CMasternode::CalculateScore(int mod, int64_t nBlockHeight)
void CMasternode::Check() void CMasternode::Check()
{ {
if(ShutdownRequested()) return;
//TODO: Random segfault with this line removed //TODO: Random segfault with this line removed
TRY_LOCK(cs_main, lockRecv); TRY_LOCK(cs_main, lockRecv);
if(!lockRecv) return; if(!lockRecv) return;

View File

@ -306,7 +306,9 @@ void OverviewPage::showOutOfSyncWarning(bool fShow)
void OverviewPage::updateDarksendProgress() void OverviewPage::updateDarksendProgress()
{ {
if(IsInitialBlockDownload()) return; if(IsInitialBlockDownload() || ShutdownRequested()) return;
if(!pwalletMain || !walletModel || !walletModel->getOptionsModel()) return;
int64_t nBalance = pwalletMain->GetBalance(); int64_t nBalance = pwalletMain->GetBalance();
QString strAmountAndRounds; QString strAmountAndRounds;