aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2020-03-19 22:53:33 +0000
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2020-03-27 15:17:35 +0000
commit41b0baf43c243b64b394e774e336475a489cca2b (patch)
tree120cb0a5a8963ba5d73e3505dcc9180d5b1fea5c /src
parentab31b9d6fe7b39713682e3f52d11238dbe042c16 (diff)
gui: Handle WalletModel::unload asynchronous
This change prevents deleting a WalletModel instance while it's being used.
Diffstat (limited to 'src')
-rw-r--r--src/qt/walletcontroller.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qt/walletcontroller.cpp b/src/qt/walletcontroller.cpp
index 233c0ab6be..88c694567e 100644
--- a/src/qt/walletcontroller.cpp
+++ b/src/qt/walletcontroller.cpp
@@ -116,7 +116,7 @@ WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wal
const bool called = QMetaObject::invokeMethod(wallet_model, "startPollBalance");
assert(called);
- connect(wallet_model, &WalletModel::unload, [this, wallet_model] {
+ connect(wallet_model, &WalletModel::unload, this, [this, wallet_model] {
// Defer removeAndDeleteWallet when no modal widget is active.
// TODO: remove this workaround by removing usage of QDiallog::exec.
if (QApplication::activeModalWidget()) {
@@ -128,7 +128,7 @@ WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wal
} else {
removeAndDeleteWallet(wallet_model);
}
- });
+ }, Qt::QueuedConnection);
// Re-emit coinsSent signal from wallet model.
connect(wallet_model, &WalletModel::coinsSent, this, &WalletController::coinsSent);