aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/qt/walletcontroller.cpp19
-rw-r--r--src/qt/walletcontroller.h3
2 files changed, 4 insertions, 18 deletions
diff --git a/src/qt/walletcontroller.cpp b/src/qt/walletcontroller.cpp
index 2aedb77798..a8e7bce6b5 100644
--- a/src/qt/walletcontroller.cpp
+++ b/src/qt/walletcontroller.cpp
@@ -99,6 +99,9 @@ WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wal
// Instantiate model and register it.
WalletModel* wallet_model = new WalletModel(std::move(wallet), m_node, m_platform_style, m_options_model, nullptr);
+ // Handler callback runs in a different thread so fix wallet model thread affinity.
+ wallet_model->moveToThread(thread());
+ wallet_model->setParent(this);
m_wallets.push_back(wallet_model);
connect(wallet_model, &WalletModel::unload, [this, wallet_model] {
@@ -119,25 +122,11 @@ WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wal
connect(wallet_model, &WalletModel::coinsSent, this, &WalletController::coinsSent);
// Notify walletAdded signal on the GUI thread.
- if (QThread::currentThread() == thread()) {
- addWallet(wallet_model);
- } else {
- // Handler callback runs in a different thread so fix wallet model thread affinity.
- wallet_model->moveToThread(thread());
- bool invoked = QMetaObject::invokeMethod(this, "addWallet", Qt::QueuedConnection, Q_ARG(WalletModel*, wallet_model));
- assert(invoked);
- }
+ Q_EMIT walletAdded(wallet_model);
return wallet_model;
}
-void WalletController::addWallet(WalletModel* wallet_model)
-{
- // Take ownership of the wallet model and register it.
- wallet_model->setParent(this);
- Q_EMIT walletAdded(wallet_model);
-}
-
void WalletController::removeAndDeleteWallet(WalletModel* wallet_model)
{
// Unregister wallet model.
diff --git a/src/qt/walletcontroller.h b/src/qt/walletcontroller.h
index 03039dd795..be1c282919 100644
--- a/src/qt/walletcontroller.h
+++ b/src/qt/walletcontroller.h
@@ -50,9 +50,6 @@ public:
OpenWalletActivity* openWallet(const std::string& name, QWidget* parent = nullptr);
void closeWallet(WalletModel* wallet_model, QWidget* parent = nullptr);
-private Q_SLOTS:
- void addWallet(WalletModel* wallet_model);
-
Q_SIGNALS:
void walletAdded(WalletModel* wallet_model);
void walletRemoved(WalletModel* wallet_model);