diff options
author | João Barbosa <joao.paulo.barbosa@gmail.com> | 2019-01-29 00:08:48 +0000 |
---|---|---|
committer | João Barbosa <joao.paulo.barbosa@gmail.com> | 2019-02-03 22:23:43 +0000 |
commit | fd6d499bdacfa29f25b0f675375e3feaced08667 (patch) | |
tree | b549686e21cd20ec5472c0253371bda172ad0988 /src | |
parent | 07b9aadcfc7cc72be9df344dd5715cf8fc78f0ad (diff) |
gui: Fix m_node.startShutdown() order
This change forwards the shutdown request on the GUI (close the
application for instace) to the node as soon as possible. This way the
GUI doesn't have to wait for long operations to complete (rescan the
wallet for instance), instead those operations detect the shutdown
request and abort/interrupt.
Diffstat (limited to 'src')
-rw-r--r-- | src/qt/bitcoin.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 0f06bbaaa6..85d79ee26c 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -309,14 +309,20 @@ void BitcoinApplication::requestShutdown() qDebug() << __func__ << ": Requesting shutdown"; startThread(); window->hide(); + // Must disconnect node signals otherwise current thread can deadlock since + // no event loop is running. + window->unsubscribeFromCoreSignals(); + // Request node shutdown, which can interrupt long operations, like + // rescanning a wallet. + m_node.startShutdown(); + // Unsetting the client model can cause the current thread to wait for node + // to complete an operation, like wait for a RPC execution to complate. window->setClientModel(nullptr); pollShutdownTimer->stop(); delete clientModel; clientModel = nullptr; - m_node.startShutdown(); - // Request shutdown from core thread Q_EMIT requestedShutdown(); } |