Skip to content

Commit 5299cfe

Browse files
committed
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.
1 parent 2242de1 commit 5299cfe

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/qt/bitcoin.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,8 @@ void BitcoinApplication::createSplashScreen(const NetworkStyle *networkStyle)
311311
{
312312
assert(!m_splash);
313313
m_splash = new SplashScreen(networkStyle);
314-
// We don't hold a direct pointer to the splash screen after creation, but the splash
315-
// screen will take care of deleting itself when finish() happens.
316314
m_splash->show();
317315
connect(this, &BitcoinApplication::splashFinished, m_splash, &SplashScreen::finish);
318-
connect(this, &BitcoinApplication::requestedShutdown, m_splash, &QWidget::close);
319316
}
320317

321318
void BitcoinApplication::createNode(interfaces::Init& init)
@@ -373,6 +370,9 @@ void BitcoinApplication::requestShutdown()
373370
w->hide();
374371
}
375372

373+
delete m_splash;
374+
m_splash = nullptr;
375+
376376
// Show a simple window indicating shutdown status
377377
// Do this first as some of the steps may take some time below,
378378
// for example the RPC console may still be executing a command.
@@ -412,10 +412,13 @@ void BitcoinApplication::requestShutdown()
412412
void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHeaderTipInfo tip_info)
413413
{
414414
qDebug() << __func__ << ": Initialization result: " << success;
415+
415416
// Set exit result.
416417
returnValue = success ? EXIT_SUCCESS : EXIT_FAILURE;
417-
if(success)
418-
{
418+
if(success) {
419+
delete m_splash;
420+
m_splash = nullptr;
421+
419422
// Log this only after AppInitMain finishes, as then logging setup is guaranteed complete
420423
qInfo() << "Platform customization:" << platformStyle->getName();
421424
clientModel = new ClientModel(node(), optionsModel);
@@ -438,7 +441,6 @@ void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHead
438441
} else {
439442
window->showMinimized();
440443
}
441-
Q_EMIT splashFinished();
442444
Q_EMIT windowShown(window);
443445

444446
#ifdef ENABLE_WALLET
@@ -455,7 +457,6 @@ void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHead
455457
#endif
456458
pollShutdownTimer->start(SHUTDOWN_POLLING_DELAY);
457459
} else {
458-
Q_EMIT splashFinished(); // Make sure splash screen doesn't stick around during shutdown
459460
requestShutdown();
460461
}
461462
}

0 commit comments

Comments
 (0)