Skip to content

Commit c391858

Browse files
furszyachow101
authored andcommitted
gui: don't remove wallet manually before migration
1 parent bfba638 commit c391858

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/qt/walletcontroller.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,10 @@ WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wal
150150
assert(called);
151151

152152
connect(wallet_model, &WalletModel::unload, this, [this, wallet_model] {
153-
// Defer removeAndDeleteWallet when no modal widget is active.
153+
// Defer removeAndDeleteWallet when no modal widget is actively waiting for an action.
154154
// TODO: remove this workaround by removing usage of QDialog::exec.
155-
if (QApplication::activeModalWidget()) {
155+
QWidget* active_dialog = QApplication::activeModalWidget();
156+
if (active_dialog && dynamic_cast<QProgressDialog*>(active_dialog) == nullptr) {
156157
connect(qApp, &QApplication::focusWindowChanged, wallet_model, [this, wallet_model]() {
157158
if (!QApplication::activeModalWidget()) {
158159
removeAndDeleteWallet(wallet_model);
@@ -463,8 +464,6 @@ void MigrateWalletActivity::migrate(WalletModel* wallet_model)
463464

464465
// GUI needs to remove the wallet so that it can actually be unloaded by migration
465466
const std::string name = wallet_model->wallet().getWalletName();
466-
m_wallet_controller->removeAndDeleteWallet(wallet_model);
467-
468467
showProgressDialog(tr("Migrate Wallet"), tr("Migrating Wallet <b>%1</b>…").arg(GUIUtil::HtmlEscape(name)));
469468

470469
QTimer::singleShot(0, worker(), [this, name, passphrase] {

0 commit comments

Comments
 (0)