mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-23 07:15:29 +01:00
Merge bitcoin-core/gui#765: Fix wallet list hover crash on shutdown
8b6470a906
gui: disable top bar menu actions during shutdown (furszy)7066e8996d
gui: provide wallet controller context to wallet actions (furszy) Pull request description: Small follow-up to #751. Fixes another crash cause during shutdown. Which occurs when the user hovers over the wallets list. Future Note: This surely happen in other places as well, we should re-work the way we connect signals. Register lambas without any precaution can leave dangling pointers. ACKs for top commit: hebasto: ACK8b6470a906
, I've tested each commit separately on macOS Sonoma 14.0 (Apple M1). Tree-SHA512: 6fbd1bcd6717a8c1633beb9371463ed22422f929cccf9b791ee292c5364134c501e099329cf77a06b74a84c64c1c3d22539199ec49ccd74b3950036316c0dab3
This commit is contained in:
commit
92704535f6
1 changed files with 10 additions and 7 deletions
|
@ -392,7 +392,7 @@ void BitcoinGUI::createActions()
|
||||||
connect(usedSendingAddressesAction, &QAction::triggered, walletFrame, &WalletFrame::usedSendingAddresses);
|
connect(usedSendingAddressesAction, &QAction::triggered, walletFrame, &WalletFrame::usedSendingAddresses);
|
||||||
connect(usedReceivingAddressesAction, &QAction::triggered, walletFrame, &WalletFrame::usedReceivingAddresses);
|
connect(usedReceivingAddressesAction, &QAction::triggered, walletFrame, &WalletFrame::usedReceivingAddresses);
|
||||||
connect(openAction, &QAction::triggered, this, &BitcoinGUI::openClicked);
|
connect(openAction, &QAction::triggered, this, &BitcoinGUI::openClicked);
|
||||||
connect(m_open_wallet_menu, &QMenu::aboutToShow, [this] {
|
connect(m_open_wallet_menu, &QMenu::aboutToShow, m_wallet_controller, [this] {
|
||||||
m_open_wallet_menu->clear();
|
m_open_wallet_menu->clear();
|
||||||
for (const std::pair<const std::string, bool>& i : m_wallet_controller->listWalletDir()) {
|
for (const std::pair<const std::string, bool>& i : m_wallet_controller->listWalletDir()) {
|
||||||
const std::string& path = i.first;
|
const std::string& path = i.first;
|
||||||
|
@ -409,7 +409,7 @@ void BitcoinGUI::createActions()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(action, &QAction::triggered, [this, path] {
|
connect(action, &QAction::triggered, m_wallet_controller, [this, path] {
|
||||||
auto activity = new OpenWalletActivity(m_wallet_controller, this);
|
auto activity = new OpenWalletActivity(m_wallet_controller, this);
|
||||||
connect(activity, &OpenWalletActivity::opened, this, &BitcoinGUI::setCurrentWallet, Qt::QueuedConnection);
|
connect(activity, &OpenWalletActivity::opened, this, &BitcoinGUI::setCurrentWallet, Qt::QueuedConnection);
|
||||||
connect(activity, &OpenWalletActivity::opened, rpcConsole, &RPCConsole::setCurrentWallet, Qt::QueuedConnection);
|
connect(activity, &OpenWalletActivity::opened, rpcConsole, &RPCConsole::setCurrentWallet, Qt::QueuedConnection);
|
||||||
|
@ -421,7 +421,7 @@ void BitcoinGUI::createActions()
|
||||||
action->setEnabled(false);
|
action->setEnabled(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(m_restore_wallet_action, &QAction::triggered, [this] {
|
connect(m_restore_wallet_action, &QAction::triggered, m_wallet_controller, [this] {
|
||||||
//: Name of the wallet data file format.
|
//: Name of the wallet data file format.
|
||||||
QString name_data_file = tr("Wallet Data");
|
QString name_data_file = tr("Wallet Data");
|
||||||
|
|
||||||
|
@ -447,14 +447,14 @@ void BitcoinGUI::createActions()
|
||||||
auto backup_file_path = fs::PathFromString(backup_file.toStdString());
|
auto backup_file_path = fs::PathFromString(backup_file.toStdString());
|
||||||
activity->restore(backup_file_path, wallet_name.toStdString());
|
activity->restore(backup_file_path, wallet_name.toStdString());
|
||||||
});
|
});
|
||||||
connect(m_close_wallet_action, &QAction::triggered, [this] {
|
connect(m_close_wallet_action, &QAction::triggered, m_wallet_controller, [this] {
|
||||||
m_wallet_controller->closeWallet(walletFrame->currentWalletModel(), this);
|
m_wallet_controller->closeWallet(walletFrame->currentWalletModel(), this);
|
||||||
});
|
});
|
||||||
connect(m_create_wallet_action, &QAction::triggered, this, &BitcoinGUI::createWallet);
|
connect(m_create_wallet_action, &QAction::triggered, this, &BitcoinGUI::createWallet);
|
||||||
connect(m_close_all_wallets_action, &QAction::triggered, [this] {
|
connect(m_close_all_wallets_action, &QAction::triggered, m_wallet_controller, [this] {
|
||||||
m_wallet_controller->closeAllWallets(this);
|
m_wallet_controller->closeAllWallets(this);
|
||||||
});
|
});
|
||||||
connect(m_migrate_wallet_action, &QAction::triggered, [this] {
|
connect(m_migrate_wallet_action, &QAction::triggered, m_wallet_controller, [this] {
|
||||||
auto activity = new MigrateWalletActivity(m_wallet_controller, this);
|
auto activity = new MigrateWalletActivity(m_wallet_controller, this);
|
||||||
connect(activity, &MigrateWalletActivity::migrated, this, &BitcoinGUI::setCurrentWallet);
|
connect(activity, &MigrateWalletActivity::migrated, this, &BitcoinGUI::setCurrentWallet);
|
||||||
activity->migrate(walletFrame->currentWalletModel());
|
activity->migrate(walletFrame->currentWalletModel());
|
||||||
|
@ -650,7 +650,8 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
|
||||||
|
|
||||||
m_mask_values_action->setChecked(_clientModel->getOptionsModel()->getOption(OptionsModel::OptionID::MaskValues).toBool());
|
m_mask_values_action->setChecked(_clientModel->getOptionsModel()->getOption(OptionsModel::OptionID::MaskValues).toBool());
|
||||||
} else {
|
} else {
|
||||||
if(trayIconMenu)
|
// Shutdown requested, disable menus
|
||||||
|
if (trayIconMenu)
|
||||||
{
|
{
|
||||||
// Disable context menu on tray icon
|
// Disable context menu on tray icon
|
||||||
trayIconMenu->clear();
|
trayIconMenu->clear();
|
||||||
|
@ -664,6 +665,8 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
|
||||||
}
|
}
|
||||||
#endif // ENABLE_WALLET
|
#endif // ENABLE_WALLET
|
||||||
unitDisplayControl->setOptionsModel(nullptr);
|
unitDisplayControl->setOptionsModel(nullptr);
|
||||||
|
// Disable top bar menu actions
|
||||||
|
appMenuBar->clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue