Skip to content

Commit deb31bb

Browse files
committed
qt, rpc: Do not accept command while executing another one
1 parent 77d16c4 commit deb31bb

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/qt/rpcconsole.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ void RPCConsole::on_lineEdit_returnPressed()
890890
{
891891
QString cmd = ui->lineEdit->text();
892892

893-
if (cmd.isEmpty()) {
893+
if (cmd.isEmpty() || m_is_executing) {
894894
return;
895895
}
896896

@@ -923,6 +923,7 @@ void RPCConsole::on_lineEdit_returnPressed()
923923

924924
message(CMD_REQUEST, QString::fromStdString(strFilteredCmd));
925925
message(CMD_REPLY, "Executing...");
926+
m_is_executing = true;
926927
Q_EMIT cmdRequest(cmd, m_last_wallet_model);
927928

928929
cmd = QString::fromStdString(strFilteredCmd);
@@ -972,6 +973,7 @@ void RPCConsole::startExecutor()
972973
connect(executor, &RPCExecutor::reply, this, [this](int category, const QString& command) {
973974
ui->messagesWidget->undo();
974975
message(category, command);
976+
m_is_executing = false;
975977
});
976978

977979
// Requests from this object must go to executor

src/qt/rpcconsole.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ public Q_SLOTS:
165165
QCompleter *autoCompleter = nullptr;
166166
QThread thread;
167167
WalletModel* m_last_wallet_model{nullptr};
168+
bool m_is_executing{false};
168169

169170
/** Update UI with latest network info from model. */
170171
void updateNetworkState();

0 commit comments

Comments
 (0)