AppInitMain should quit early and return false
if shutdown was requested at some point (#3267)
This fixes crashes e.g. when user decided to shutdown while rescanning the wallet
This commit is contained in:
parent
42e104932d
commit
817cd9a177
31
src/init.cpp
31
src/init.cpp
@ -1974,6 +1974,14 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
LogPrintf("No wallet support compiled in!\n");
|
LogPrintf("No wallet support compiled in!\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// As InitLoadWallet can take several minutes, it's possible the user
|
||||||
|
// requested to kill the GUI during the last operation. If so, exit.
|
||||||
|
if (fRequestShutdown)
|
||||||
|
{
|
||||||
|
LogPrintf("Shutdown requested. Exiting.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// ********************************************************* Step 9: data directory maintenance
|
// ********************************************************* Step 9: data directory maintenance
|
||||||
|
|
||||||
// if pruning, unset the service bit and perform the initial blockstore prune
|
// if pruning, unset the service bit and perform the initial blockstore prune
|
||||||
@ -1987,6 +1995,14 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// As PruneAndFlush can take several minutes, it's possible the user
|
||||||
|
// requested to kill the GUI during the last operation. If so, exit.
|
||||||
|
if (fRequestShutdown)
|
||||||
|
{
|
||||||
|
LogPrintf("Shutdown requested. Exiting.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// ********************************************************* Step 10a: Prepare Masternode related stuff
|
// ********************************************************* Step 10a: Prepare Masternode related stuff
|
||||||
fMasternodeMode = false;
|
fMasternodeMode = false;
|
||||||
std::string strMasterNodeBLSPrivKey = gArgs.GetArg("-masternodeblsprivkey", "");
|
std::string strMasterNodeBLSPrivKey = gArgs.GetArg("-masternodeblsprivkey", "");
|
||||||
@ -2139,6 +2155,14 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
uiInterface.NotifyBlockTip.disconnect(BlockNotifyGenesisWait);
|
uiInterface.NotifyBlockTip.disconnect(BlockNotifyGenesisWait);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// As importing blocks can take several minutes, it's possible the user
|
||||||
|
// requested to kill the GUI during one of the last operations. If so, exit.
|
||||||
|
if (fRequestShutdown)
|
||||||
|
{
|
||||||
|
LogPrintf("Shutdown requested. Exiting.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// ********************************************************* Step 12: start node
|
// ********************************************************* Step 12: start node
|
||||||
|
|
||||||
//// debug print
|
//// debug print
|
||||||
@ -2212,5 +2236,12 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Final check if the user requested to kill the GUI during one of the last operations. If so, exit.
|
||||||
|
if (fRequestShutdown)
|
||||||
|
{
|
||||||
|
LogPrintf("Shutdown requested. Exiting.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user