aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoin.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2016-11-18 16:35:14 +0100
committerWladimir J. van der Laan <[email protected]>2016-11-23 12:33:36 +0100
commit693384eedb1ac7f449e226edd53e2cb52a86e279 (patch)
tree898d2bc8d3667c56bdd32c656b03f478e305d99f /src/qt/bitcoin.cpp
parentqt: Plug many memory leaks (diff)
downloaddiscoin-693384eedb1ac7f449e226edd53e2cb52a86e279.tar.xz
discoin-693384eedb1ac7f449e226edd53e2cb52a86e279.zip
qt: Prevent thread/memory leak on exiting RPCConsole
Make ownership of the QThread object clear, so that the RPCConsole can wait for the executor thread to quit before shutdown is called. This increases overall thread safety, and prevents some objects from leaking on exit.
Diffstat (limited to 'src/qt/bitcoin.cpp')
-rw-r--r--src/qt/bitcoin.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index c828234f4..1434c45dd 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -409,6 +409,11 @@ void BitcoinApplication::requestInitialize()
void BitcoinApplication::requestShutdown()
{
+ // 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.
+ ShutdownWindow::showShutdownWindow(window);
+
qDebug() << __func__ << ": Requesting shutdown";
startThread();
window->hide();
@@ -423,9 +428,6 @@ void BitcoinApplication::requestShutdown()
delete clientModel;
clientModel = 0;
- // Show a simple window indicating shutdown status
- ShutdownWindow::showShutdownWindow(window);
-
// Request shutdown from core thread
Q_EMIT requestedShutdown();
}