qt, rpc: Do not accept command while executing another one

This commit is contained in:
Hennadii Stepanov 2021-03-20 05:01:27 +02:00
parent 0c32b9c527
commit 38eb37c0bd
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
2 changed files with 7 additions and 0 deletions

View file

@ -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

View file

@ -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();