Skip to content

Commit fdf7285

Browse files
committed
refactor: Make RPCExecutor* a member of the RPCConsole class
1 parent 61457c1 commit fdf7285

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/qt/rpcconsole.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,11 +1091,11 @@ void RPCConsole::browseHistory(int offset)
10911091

10921092
void RPCConsole::startExecutor()
10931093
{
1094-
RPCExecutor *executor = new RPCExecutor(m_node);
1095-
executor->moveToThread(&thread);
1094+
m_executor = new RPCExecutor(m_node);
1095+
m_executor->moveToThread(&thread);
10961096

10971097
// Replies from executor object must go to this object
1098-
connect(executor, &RPCExecutor::reply, this, [this](int category, const QString& command) {
1098+
connect(m_executor, &RPCExecutor::reply, this, [this](int category, const QString& command) {
10991099
// Remove "Executing…" message.
11001100
ui->messagesWidget->undo();
11011101
message(category, command);
@@ -1104,15 +1104,15 @@ void RPCConsole::startExecutor()
11041104
});
11051105

11061106
// Requests from this object must go to executor
1107-
connect(this, &RPCConsole::cmdRequest, executor, &RPCExecutor::request);
1107+
connect(this, &RPCConsole::cmdRequest, m_executor, &RPCExecutor::request);
11081108

11091109
// Make sure executor object is deleted in its own thread
1110-
connect(&thread, &QThread::finished, executor, &RPCExecutor::deleteLater);
1110+
connect(&thread, &QThread::finished, m_executor, &RPCExecutor::deleteLater);
11111111

11121112
// Default implementation of QThread::run() simply spins up an event loop in the thread,
11131113
// which is what we want.
11141114
thread.start();
1115-
QTimer::singleShot(0, executor, []() {
1115+
QTimer::singleShot(0, m_executor, []() {
11161116
util::ThreadRename("qt-rpcconsole");
11171117
});
11181118
}

src/qt/rpcconsole.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
class ClientModel;
2323
class PlatformStyle;
24+
class RPCExecutor;
2425
class RPCTimerInterface;
2526
class WalletModel;
2627

@@ -173,6 +174,7 @@ public Q_SLOTS:
173174
int consoleFontSize = 0;
174175
QCompleter *autoCompleter = nullptr;
175176
QThread thread;
177+
RPCExecutor* m_executor{nullptr};
176178
WalletModel* m_last_wallet_model{nullptr};
177179
bool m_is_executing{false};
178180
QByteArray m_peer_widget_header_state;

0 commit comments

Comments
 (0)