diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2022-04-21 00:13:12 +0200 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2022-04-21 13:35:59 +0200 |
commit | fdf72859504d063d0a6b60a6dac5ad170bd86440 (patch) | |
tree | 8bbf7e2c014bd5ea56b0ab2a9b70dc926c6e6826 | |
parent | 61457c179aec23227dcf3952c575052204103b50 (diff) |
refactor: Make `RPCExecutor*` a member of the `RPCConsole` class
-rw-r--r-- | src/qt/rpcconsole.cpp | 12 | ||||
-rw-r--r-- | src/qt/rpcconsole.h | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index eb69fabe89..337e744da8 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -1091,11 +1091,11 @@ void RPCConsole::browseHistory(int offset) void RPCConsole::startExecutor() { - RPCExecutor *executor = new RPCExecutor(m_node); - executor->moveToThread(&thread); + m_executor = new RPCExecutor(m_node); + m_executor->moveToThread(&thread); // Replies from executor object must go to this object - connect(executor, &RPCExecutor::reply, this, [this](int category, const QString& command) { + connect(m_executor, &RPCExecutor::reply, this, [this](int category, const QString& command) { // Remove "Executing…" message. ui->messagesWidget->undo(); message(category, command); @@ -1104,15 +1104,15 @@ void RPCConsole::startExecutor() }); // Requests from this object must go to executor - connect(this, &RPCConsole::cmdRequest, executor, &RPCExecutor::request); + connect(this, &RPCConsole::cmdRequest, m_executor, &RPCExecutor::request); // Make sure executor object is deleted in its own thread - connect(&thread, &QThread::finished, executor, &RPCExecutor::deleteLater); + connect(&thread, &QThread::finished, m_executor, &RPCExecutor::deleteLater); // Default implementation of QThread::run() simply spins up an event loop in the thread, // which is what we want. thread.start(); - QTimer::singleShot(0, executor, []() { + QTimer::singleShot(0, m_executor, []() { util::ThreadRename("qt-rpcconsole"); }); } diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 30e41bae0b..94bc513c5b 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -21,6 +21,7 @@ class ClientModel; class PlatformStyle; +class RPCExecutor; class RPCTimerInterface; class WalletModel; @@ -173,6 +174,7 @@ private: int consoleFontSize = 0; QCompleter *autoCompleter = nullptr; QThread thread; + RPCExecutor* m_executor{nullptr}; WalletModel* m_last_wallet_model{nullptr}; bool m_is_executing{false}; QByteArray m_peer_widget_header_state; |