From 38eb37c0bd29b4cb825de905e8eec87636a5221b Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Sat, 20 Mar 2021 05:01:27 +0200 Subject: qt, rpc: Do not accept command while executing another one --- src/qt/rpcconsole.cpp | 6 ++++++ src/qt/rpcconsole.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index f9a53e8d60..c762f2b9c8 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -949,6 +949,10 @@ void RPCConsole::on_lineEdit_returnPressed() return; } + if (m_is_executing) { + return; + } + ui->lineEdit->clear(); #ifdef ENABLE_WALLET @@ -967,6 +971,7 @@ void RPCConsole::on_lineEdit_returnPressed() message(CMD_REQUEST, QString::fromStdString(strFilteredCmd)); //: A console message indicating an entered command is currently being executed. message(CMD_REPLY, tr("Executing…")); + m_is_executing = true; Q_EMIT cmdRequest(cmd, m_last_wallet_model); cmd = QString::fromStdString(strFilteredCmd); @@ -1018,6 +1023,7 @@ void RPCConsole::startExecutor() ui->messagesWidget->undo(); message(category, command); scrollToEnd(); + m_is_executing = false; }); // Requests from this object must go to executor diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 55a1decceb..75f466642b 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -166,6 +166,7 @@ private: QCompleter *autoCompleter = nullptr; QThread thread; WalletModel* m_last_wallet_model{nullptr}; + bool m_is_executing{false}; /** Update UI with latest network info from model. */ void updateNetworkState(); -- cgit v1.2.3