mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 19:23:26 -03:00
Merge bitcoin-core/gui#605: Delete splash screen widget early
1b228497fa
qt: Drop no longer used `SplashScreen::finish()` slot (Hennadii Stepanov)10811afff4
qt: Drop no longer used `BitcoinApplication::splashFinished()` signal (Hennadii Stepanov)5299cfe371
qt: Delete splash screen widget explicitly (Hennadii Stepanov) Pull request description: Fixes bitcoin-core/gui#604. Fixes bitcoin/bitcoin#25146. Fixes bitcoin/bitcoin#26340. `SplashScreen::deleteLater()` [does not guarantee](https://doc.qt.io/qt-5/qobject.html#deleteLater) deletion of the `m_splash` object prior to the wallet context deletion. If the latter happens first, the [segfault](https://github.com/bitcoin-core/gui/issues/604#issuecomment-1133907013) follows. ACKs for top commit: dooglus: ACK1b228497fa
furszy: ACK1b228497
john-moffett: ACK1b228497fa
Tree-SHA512: bb01d0bf2051f5b184dc415c4f5d32dfb7b8bd772feff7ec7754ded4c6482de27f004b9712df7d53c5ee82e153f48aef4372e4a49d7bcbbb137f73e9b4947962
This commit is contained in:
commit
497f26552b
4 changed files with 8 additions and 22 deletions
|
@ -311,11 +311,7 @@ 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::requestedShutdown, m_splash, &QWidget::close);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinApplication::createNode(interfaces::Init& init)
|
void BitcoinApplication::createNode(interfaces::Init& init)
|
||||||
|
@ -373,6 +369,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 +411,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 +440,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 +456,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,6 @@ public Q_SLOTS:
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void requestedInitialize();
|
void requestedInitialize();
|
||||||
void requestedShutdown();
|
void requestedShutdown();
|
||||||
void splashFinished();
|
|
||||||
void windowShown(BitcoinGUI* window);
|
void windowShown(BitcoinGUI* window);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -161,16 +161,6 @@ bool SplashScreen::eventFilter(QObject * obj, QEvent * ev) {
|
||||||
return QObject::eventFilter(obj, ev);
|
return QObject::eventFilter(obj, ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplashScreen::finish()
|
|
||||||
{
|
|
||||||
/* If the window is minimized, hide() will be ignored. */
|
|
||||||
/* Make sure we de-minimize the splashscreen window before hiding */
|
|
||||||
if (isMinimized())
|
|
||||||
showNormal();
|
|
||||||
hide();
|
|
||||||
deleteLater(); // No more need for this
|
|
||||||
}
|
|
||||||
|
|
||||||
static void InitMessage(SplashScreen *splash, const std::string &message)
|
static void InitMessage(SplashScreen *splash, const std::string &message)
|
||||||
{
|
{
|
||||||
bool invoked = QMetaObject::invokeMethod(splash, "showMessage",
|
bool invoked = QMetaObject::invokeMethod(splash, "showMessage",
|
||||||
|
|
|
@ -37,9 +37,6 @@ protected:
|
||||||
void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/** Hide the splash screen window and schedule the splash screen object for deletion */
|
|
||||||
void finish();
|
|
||||||
|
|
||||||
/** Show message and progress */
|
/** Show message and progress */
|
||||||
void showMessage(const QString &message, int alignment, const QColor &color);
|
void showMessage(const QString &message, int alignment, const QColor &color);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue