mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 12:22:39 -03:00
gui: Handle WalletModel::unload asynchronous
This change prevents deleting a WalletModel instance while it's being used.
This commit is contained in:
parent
ab31b9d6fe
commit
41b0baf43c
1 changed files with 2 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue