aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-10-27 12:54:09 +0100
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-10-27 12:58:48 +0100
commit5299cfe371ddad806b1c4538d17cde069e25b1c1 (patch)
tree54d66c15470a12a3668c7ae6c0e5658cc3e9cdd1 /src/qt
parent2242de16cc590c0cc115bf9b54679521b9be7bbd (diff)
downloadbitcoin-5299cfe371ddad806b1c4538d17cde069e25b1c1.tar.xz
qt: Delete splash screen widget explicitly
This ensures that during shutdown, including failed initialization, the `SplashScreen::m_connected_wallet_handlers` is deleted before the wallet context is.
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/bitcoin.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index cc01e4d54a..24af58a731 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -311,11 +311,8 @@ void BitcoinApplication::createSplashScreen(const NetworkStyle *networkStyle)
{
assert(!m_splash);
m_splash = new SplashScreen(networkStyle);
- // We don't hold a direct pointer to the splash screen after creation, but the splash
- // screen will take care of deleting itself when finish() happens.
m_splash->show();
connect(this, &BitcoinApplication::splashFinished, m_splash, &SplashScreen::finish);
- connect(this, &BitcoinApplication::requestedShutdown, m_splash, &QWidget::close);
}
void BitcoinApplication::createNode(interfaces::Init& init)
@@ -373,6 +370,9 @@ void BitcoinApplication::requestShutdown()
w->hide();
}
+ delete m_splash;
+ m_splash = nullptr;
+
// Show a simple window indicating shutdown status
// Do this first as some of the steps may take some time below,
// for example the RPC console may still be executing a command.
@@ -412,10 +412,13 @@ void BitcoinApplication::requestShutdown()
void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHeaderTipInfo tip_info)
{
qDebug() << __func__ << ": Initialization result: " << success;
+
// Set exit result.
returnValue = success ? EXIT_SUCCESS : EXIT_FAILURE;
- if(success)
- {
+ if(success) {
+ delete m_splash;
+ m_splash = nullptr;
+
// Log this only after AppInitMain finishes, as then logging setup is guaranteed complete
qInfo() << "Platform customization:" << platformStyle->getName();
clientModel = new ClientModel(node(), optionsModel);
@@ -438,7 +441,6 @@ void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHead
} else {
window->showMinimized();
}
- Q_EMIT splashFinished();
Q_EMIT windowShown(window);
#ifdef ENABLE_WALLET
@@ -455,7 +457,6 @@ void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHead
#endif
pollShutdownTimer->start(SHUTDOWN_POLLING_DELAY);
} else {
- Q_EMIT splashFinished(); // Make sure splash screen doesn't stick around during shutdown
requestShutdown();
}
}