The application would either quit or std::exit on failure and not even try a shutdown.
Note that bitcoind does a Interrupt and Shutdown in case the initialization fails or an exception is caught. So just do the same for the gui.
The application would either quit or std::exit on failure and not even try a shutdown.
Note that bitcoind does a Interrupt and Shutdown in case the initialization fails or an exception is caught. So just do the same for the gui.
523@@ -513,10 +524,6 @@ void BitcoinApplication::initializeResult(bool success)
524 QTimer::singleShot(100, paymentServer, SLOT(uiReady()));
525 #endif
526 pollShutdownTimer->start(200);
527- } else {
528- Q_EMIT splashFinished(window); // Make sure splash screen doesn't stick around during shutdown
250@@ -251,6 +251,10 @@ BitcoinCore::BitcoinCore(interfaces::Node& node) :
251 void BitcoinCore::handleRunawayException(const std::exception *e)
252 {
253 PrintExceptionContinue(e, "Runaway exception");
254+ try {
255+ m_node.appShutdown();
256+ } catch (...) {
257+ }
470@@ -465,8 +471,17 @@ void BitcoinApplication::initializeResult(bool success)
471 qDebug() << __func__ << ": Initialization result: " << success;
472 // Set exit result.
473 returnValue = success ? EXIT_SUCCESS : EXIT_FAILURE;
474- if(success)
475- {
476+ if (!success) {
477+ try {
478+ m_node.appShutdown();
I don’t think it is right to call appShutdown() here because it should be covered by return quit(); below. quit should cause the first application loop to quit, which should trigger requestShutdown():
which should trigger requestedShutdown():
which should trigger BitcoinCore::shutdown:
which already calls appShutdown():
The shutdown process is definitely overcomplicated and should be simplified. I think a good direction would be to stop calling QApplication::quit during shutdown and instead just call it after. So Qt shutdown would just immediately follow bitcoin shutdown instead of being mingled with it.
250@@ -251,6 +251,12 @@ BitcoinCore::BitcoinCore(interfaces::Node& node) :
251 void BitcoinCore::handleRunawayException(const std::exception *e)
252 {
253 PrintExceptionContinue(e, "Runaway exception");
254+ try {
255+ m_node.appShutdown();
256+ } catch (const std::exception& e) {
257+ PrintExceptionContinue(&e, __func__);
258+ } catch (...) {
259+ }
boost::current_exception_diagnostic_information() could also be used to add more detail.
250@@ -251,6 +251,12 @@ BitcoinCore::BitcoinCore(interfaces::Node& node) :
251 void BitcoinCore::handleRunawayException(const std::exception *e)
252 {
253 PrintExceptionContinue(e, "Runaway exception");
254+ try {
255+ m_node.appShutdown();
This doesn’t seem like the right place to be calling appShutdown. The emit below is supposed to trigger BitcoinApplication::handleRunawayException:
which is supposed to show an error dialog and then exit:
If you shut down in BitcoinCore::handleRunawayException, it seems like this is going to delay the dialog from showing up, and maybe even prevent it from being seen by the user. But if this is really an improvement, it would be good to have a comment explaining what the shutdown sequence is.
250@@ -251,6 +251,12 @@ BitcoinCore::BitcoinCore(interfaces::Node& node) :
251 void BitcoinCore::handleRunawayException(const std::exception *e)
252 {
253 PrintExceptionContinue(e, "Runaway exception");
254+ try {
255+ m_node.appShutdown();
256+ } catch (const std::exception& e) {
e here shadows the function parameter in BitcoinCore::handleRunawayException(const std::exception *e).
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
No conflicts as of last run.
Up for grabs.