diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2019-01-17 14:28:48 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2019-01-17 14:40:26 +0100 |
commit | 7ee604487f547cc63413bc691609f38703dc6d6a (patch) | |
tree | 7bd80c4f01773b19aa85618e344d34867a758fb7 /src/qt | |
parent | fcb6694a9945d2a02f40587e18bd395ef64048e0 (diff) | |
parent | 24313fbf7e3d69145bc18c089601ba7aea35d61c (diff) |
Merge #14250: qt: Remove redundant stopThread() and stopExecutor() signals
24313fbf7e3d69145bc18c089601ba7aea35d61c Remove redundant stopExecutor() signal (Hennadii Stepanov)
1c0e0a5e38102a67cb66cf6eef4098bdb64bb0f5 Remove redundant stopThread() signal (Hennadii Stepanov)
Pull request description:
The `QThread::finished` signal do this work.
Tree-SHA512: 1afce23d30232276d50c3af5af79d83b88e390a2b71f7df585cc1079585d330447d179bbc34c0a89599beb2da035dfd5b9ce23238171490825cabc3a19ae6e67
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/bitcoin.cpp | 5 | ||||
-rw-r--r-- | src/qt/bitcoin.h | 1 | ||||
-rw-r--r-- | src/qt/intro.cpp | 5 | ||||
-rw-r--r-- | src/qt/intro.h | 1 | ||||
-rw-r--r-- | src/qt/rpcconsole.cpp | 10 | ||||
-rw-r--r-- | src/qt/rpcconsole.h | 1 |
6 files changed, 7 insertions, 16 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 893dda1601..fb433c2957 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -212,7 +212,7 @@ BitcoinApplication::~BitcoinApplication() if(coreThread) { qDebug() << __func__ << ": Stopping thread"; - Q_EMIT stopThread(); + coreThread->quit(); coreThread->wait(); qDebug() << __func__ << ": Stopped thread"; } @@ -279,8 +279,7 @@ void BitcoinApplication::startThread() connect(this, &BitcoinApplication::requestedInitialize, executor, &BitcoinCore::initialize); connect(this, &BitcoinApplication::requestedShutdown, executor, &BitcoinCore::shutdown); /* make sure executor object is deleted in its own thread */ - connect(this, &BitcoinApplication::stopThread, executor, &QObject::deleteLater); - connect(this, &BitcoinApplication::stopThread, coreThread, &QThread::quit); + connect(coreThread, &QThread::finished, executor, &QObject::deleteLater); coreThread->start(); } diff --git a/src/qt/bitcoin.h b/src/qt/bitcoin.h index 48b5907570..ffed45236c 100644 --- a/src/qt/bitcoin.h +++ b/src/qt/bitcoin.h @@ -99,7 +99,6 @@ public Q_SLOTS: Q_SIGNALS: void requestedInitialize(); void requestedShutdown(); - void stopThread(); void splashFinished(); void windowShown(BitcoinGUI* window); diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index fa9a50b1ed..69972fce3b 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -156,7 +156,7 @@ Intro::~Intro() { delete ui; /* Ensure thread is finished before it is deleted */ - Q_EMIT stopThread(); + thread->quit(); thread->wait(); } @@ -311,8 +311,7 @@ void Intro::startThread() connect(executor, &FreespaceChecker::reply, this, &Intro::setStatus); connect(this, &Intro::requestCheck, executor, &FreespaceChecker::check); /* make sure executor object is deleted in its own thread */ - connect(this, &Intro::stopThread, executor, &QObject::deleteLater); - connect(this, &Intro::stopThread, thread, &QThread::quit); + connect(thread, &QThread::finished, executor, &QObject::deleteLater); thread->start(); } diff --git a/src/qt/intro.h b/src/qt/intro.h index 3da8a16114..b537c94f7d 100644 --- a/src/qt/intro.h +++ b/src/qt/intro.h @@ -55,7 +55,6 @@ public: Q_SIGNALS: void requestCheck(); - void stopThread(); public Q_SLOTS: void setStatus(int status, const QString &message, quint64 bytesAvailable); diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 2949e43915..351da6976a 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -688,8 +688,7 @@ void RPCConsole::setClientModel(ClientModel *model) } if (!model) { // Client model is being set to 0, this means shutdown() is about to be called. - // Make sure we clean up the executor thread - Q_EMIT stopExecutor(); + thread.quit(); thread.wait(); } } @@ -975,11 +974,8 @@ void RPCConsole::startExecutor() // Requests from this object must go to executor connect(this, &RPCConsole::cmdRequest, executor, &RPCExecutor::request); - // On stopExecutor signal - // - quit the Qt event loop in the execution thread - connect(this, &RPCConsole::stopExecutor, &thread, &QThread::quit); - // - queue executor for deletion (in execution thread) - connect(&thread, &QThread::finished, executor, &RPCExecutor::deleteLater, Qt::DirectConnection); + // Make sure executor object is deleted in its own thread + connect(&thread, &QThread::finished, executor, &RPCExecutor::deleteLater); // Default implementation of QThread::run() simply spins up an event loop in the thread, // which is what we want. diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 6c000ba096..79b0f3b19c 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -132,7 +132,6 @@ public Q_SLOTS: Q_SIGNALS: // For RPC command executor - void stopExecutor(); void cmdRequest(const QString &command, const WalletModel* wallet_model); private: |