mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-12 04:42:36 -03:00
Do not pass WalletModel*
to queued connection
Passing a `WalletModel*` object to a queued connection when the `ENABLE_WALLET` macro is undefined make code flawed.
This commit is contained in:
parent
fdf7285950
commit
ab73d5985d
2 changed files with 6 additions and 9 deletions
|
@ -1032,8 +1032,9 @@ void RPCConsole::on_lineEdit_returnPressed()
|
||||||
|
|
||||||
ui->lineEdit->clear();
|
ui->lineEdit->clear();
|
||||||
|
|
||||||
|
WalletModel* wallet_model{nullptr};
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
WalletModel* wallet_model = ui->WalletSelector->currentData().value<WalletModel*>();
|
wallet_model = ui->WalletSelector->currentData().value<WalletModel*>();
|
||||||
|
|
||||||
if (m_last_wallet_model != wallet_model) {
|
if (m_last_wallet_model != wallet_model) {
|
||||||
if (wallet_model) {
|
if (wallet_model) {
|
||||||
|
@ -1049,7 +1050,10 @@ void RPCConsole::on_lineEdit_returnPressed()
|
||||||
//: A console message indicating an entered command is currently being executed.
|
//: A console message indicating an entered command is currently being executed.
|
||||||
message(CMD_REPLY, tr("Executing…"));
|
message(CMD_REPLY, tr("Executing…"));
|
||||||
m_is_executing = true;
|
m_is_executing = true;
|
||||||
Q_EMIT cmdRequest(cmd, m_last_wallet_model);
|
|
||||||
|
QMetaObject::invokeMethod(m_executor, [this, cmd, wallet_model] {
|
||||||
|
m_executor->request(cmd, wallet_model);
|
||||||
|
});
|
||||||
|
|
||||||
cmd = QString::fromStdString(strFilteredCmd);
|
cmd = QString::fromStdString(strFilteredCmd);
|
||||||
|
|
||||||
|
@ -1103,9 +1107,6 @@ void RPCConsole::startExecutor()
|
||||||
m_is_executing = false;
|
m_is_executing = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Requests from this object must go to executor
|
|
||||||
connect(this, &RPCConsole::cmdRequest, m_executor, &RPCExecutor::request);
|
|
||||||
|
|
||||||
// Make sure executor object is deleted in its own thread
|
// Make sure executor object is deleted in its own thread
|
||||||
connect(&thread, &QThread::finished, m_executor, &RPCExecutor::deleteLater);
|
connect(&thread, &QThread::finished, m_executor, &RPCExecutor::deleteLater);
|
||||||
|
|
||||||
|
|
|
@ -137,10 +137,6 @@ public Q_SLOTS:
|
||||||
/** set which tab has the focus (is visible) */
|
/** set which tab has the focus (is visible) */
|
||||||
void setTabFocus(enum TabTypes tabType);
|
void setTabFocus(enum TabTypes tabType);
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
// For RPC command executor
|
|
||||||
void cmdRequest(const QString &command, const WalletModel* wallet_model);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct TranslatedStrings {
|
struct TranslatedStrings {
|
||||||
const QString yes{tr("Yes")}, no{tr("No")}, to{tr("To")}, from{tr("From")},
|
const QString yes{tr("Yes")}, no{tr("No")}, to{tr("To")}, from{tr("From")},
|
||||||
|
|
Loading…
Reference in a new issue