mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-23 15:20:49 +01:00
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.
This commit is contained in:
parent
2242de16cc
commit
5299cfe371
1 changed files with 8 additions and 7 deletions
|
@ -311,11 +311,8 @@ void BitcoinApplication::createSplashScreen(const NetworkStyle *networkStyle)
|
||||||
{
|
{
|
||||||
assert(!m_splash);
|
assert(!m_splash);
|
||||||
m_splash = new SplashScreen(networkStyle);
|
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();
|
m_splash->show();
|
||||||
connect(this, &BitcoinApplication::splashFinished, m_splash, &SplashScreen::finish);
|
connect(this, &BitcoinApplication::splashFinished, m_splash, &SplashScreen::finish);
|
||||||
connect(this, &BitcoinApplication::requestedShutdown, m_splash, &QWidget::close);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinApplication::createNode(interfaces::Init& init)
|
void BitcoinApplication::createNode(interfaces::Init& init)
|
||||||
|
@ -373,6 +370,9 @@ void BitcoinApplication::requestShutdown()
|
||||||
w->hide();
|
w->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete m_splash;
|
||||||
|
m_splash = nullptr;
|
||||||
|
|
||||||
// Show a simple window indicating shutdown status
|
// Show a simple window indicating shutdown status
|
||||||
// Do this first as some of the steps may take some time below,
|
// Do this first as some of the steps may take some time below,
|
||||||
// for example the RPC console may still be executing a command.
|
// 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)
|
void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHeaderTipInfo tip_info)
|
||||||
{
|
{
|
||||||
qDebug() << __func__ << ": Initialization result: " << success;
|
qDebug() << __func__ << ": Initialization result: " << success;
|
||||||
|
|
||||||
// Set exit result.
|
// Set exit result.
|
||||||
returnValue = success ? EXIT_SUCCESS : EXIT_FAILURE;
|
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
|
// Log this only after AppInitMain finishes, as then logging setup is guaranteed complete
|
||||||
qInfo() << "Platform customization:" << platformStyle->getName();
|
qInfo() << "Platform customization:" << platformStyle->getName();
|
||||||
clientModel = new ClientModel(node(), optionsModel);
|
clientModel = new ClientModel(node(), optionsModel);
|
||||||
|
@ -438,7 +441,6 @@ void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHead
|
||||||
} else {
|
} else {
|
||||||
window->showMinimized();
|
window->showMinimized();
|
||||||
}
|
}
|
||||||
Q_EMIT splashFinished();
|
|
||||||
Q_EMIT windowShown(window);
|
Q_EMIT windowShown(window);
|
||||||
|
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
|
@ -455,7 +457,6 @@ void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHead
|
||||||
#endif
|
#endif
|
||||||
pollShutdownTimer->start(SHUTDOWN_POLLING_DELAY);
|
pollShutdownTimer->start(SHUTDOWN_POLLING_DELAY);
|
||||||
} else {
|
} else {
|
||||||
Q_EMIT splashFinished(); // Make sure splash screen doesn't stick around during shutdown
|
|
||||||
requestShutdown();
|
requestShutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue