@@ -410,16 +410,17 @@ void BitcoinGUI::createActions()
410
410
QAction* action = m_open_wallet_menu->addAction (name);
411
411
412
412
if (loaded || is_legacy) {
413
- // This wallet is already loaded or it is a legacy wallet
414
413
action->setEnabled (false );
415
414
continue ;
416
415
}
417
416
418
- connect (action, &QAction::triggered, [this , path] {
417
+ // Create a local copy of path to capture
418
+ const auto captured_path = path;
419
+ connect (action, &QAction::triggered, [this , captured_path] {
419
420
auto activity = new OpenWalletActivity (m_wallet_controller, this );
420
421
connect (activity, &OpenWalletActivity::opened, this , &BitcoinGUI::setCurrentWallet, Qt::QueuedConnection);
421
422
connect (activity, &OpenWalletActivity::opened, rpcConsole, &RPCConsole::setCurrentWallet, Qt::QueuedConnection);
422
- activity->open (path );
423
+ activity->open (captured_path );
423
424
});
424
425
}
425
426
if (m_open_wallet_menu->isEmpty ()) {
@@ -475,10 +476,12 @@ void BitcoinGUI::createActions()
475
476
name.replace (QChar (' &' ), QString (" &&" ));
476
477
QAction* action = m_migrate_wallet_menu->addAction (name);
477
478
478
- connect (action, &QAction::triggered, [this , wallet_name] {
479
+ // Create a local copy of wallet_name to capture
480
+ const auto captured_wallet_name = wallet_name;
481
+ connect (action, &QAction::triggered, [this , captured_wallet_name] {
479
482
auto activity = new MigrateWalletActivity (m_wallet_controller, this );
480
483
connect (activity, &MigrateWalletActivity::migrated, this , &BitcoinGUI::setCurrentWallet);
481
- activity->migrate (wallet_name );
484
+ activity->migrate (captured_wallet_name );
482
485
});
483
486
}
484
487
if (m_migrate_wallet_menu->isEmpty ()) {
0 commit comments