aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-11-19 11:08:19 +0100
committerLuke Dashjr <luke-jr+git@utopios.org>2016-12-02 07:50:11 +0000
commite4bea4fb84dceab44f8a8de4f8b974ba8bb98529 (patch)
treed44223dafcc9e8823b78ac8e032330a86dbe71ac
parentc12f4e93b9be01ba2d6e96f0a851562549049686 (diff)
downloadbitcoin-e4bea4fb84dceab44f8a8de4f8b974ba8bb98529.tar.xz
qt: Avoid splash-screen related memory leak
Make splash screen queue its own deletion when it receives the finished command, instead of relying on WA_DeleteOnClose which doesn't work under these circumstances. Github-Pull: #9190 Rebased-From: e4f126a7ba66e7317718c30276dff6db92dc1986
-rw-r--r--src/qt/bitcoin.cpp5
-rw-r--r--src/qt/splashscreen.cpp1
2 files changed, 3 insertions, 3 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index ca017b2f7b..d708f4b111 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -365,9 +365,8 @@ void BitcoinApplication::createWindow(const NetworkStyle *networkStyle)
void BitcoinApplication::createSplashScreen(const NetworkStyle *networkStyle)
{
SplashScreen *splash = new SplashScreen(0, networkStyle);
- // We don't hold a direct pointer to the splash screen after creation, so use
- // Qt::WA_DeleteOnClose to make sure that the window will be deleted eventually.
- splash->setAttribute(Qt::WA_DeleteOnClose);
+ // We don't hold a direct pointer to the splash screen after creation, but the splash
+ // screen will take care of deleting itself when slotFinish happens.
splash->show();
connect(this, SIGNAL(splashFinished(QWidget*)), splash, SLOT(slotFinish(QWidget*)));
connect(this, SIGNAL(requestedShutdown()), splash, SLOT(close()));
diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp
index e36d86fddd..68e9ffeb94 100644
--- a/src/qt/splashscreen.cpp
+++ b/src/qt/splashscreen.cpp
@@ -147,6 +147,7 @@ void SplashScreen::slotFinish(QWidget *mainWin)
if (isMinimized())
showNormal();
hide();
+ deleteLater(); // No more need for this
}
static void InitMessage(SplashScreen *splash, const std::string &message)