Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wallet list hover crash on shutdown #765

Merged
merged 2 commits into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ void BitcoinGUI::createActions()
connect(usedSendingAddressesAction, &QAction::triggered, walletFrame, &WalletFrame::usedSendingAddresses);
connect(usedReceivingAddressesAction, &QAction::triggered, walletFrame, &WalletFrame::usedReceivingAddresses);
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();
for (const std::pair<const std::string, bool>& i : m_wallet_controller->listWalletDir()) {
const std::string& path = i.first;
Expand All @@ -409,7 +409,7 @@ void BitcoinGUI::createActions()
continue;
}

connect(action, &QAction::triggered, [this, path] {
connect(action, &QAction::triggered, m_wallet_controller, [this, path] {
auto activity = new OpenWalletActivity(m_wallet_controller, this);
connect(activity, &OpenWalletActivity::opened, this, &BitcoinGUI::setCurrentWallet, Qt::QueuedConnection);
connect(activity, &OpenWalletActivity::opened, rpcConsole, &RPCConsole::setCurrentWallet, Qt::QueuedConnection);
Expand All @@ -421,7 +421,7 @@ void BitcoinGUI::createActions()
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.
QString name_data_file = tr("Wallet Data");

Expand All @@ -447,14 +447,14 @@ void BitcoinGUI::createActions()
auto backup_file_path = fs::PathFromString(backup_file.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);
});
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);
});
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);
connect(activity, &MigrateWalletActivity::migrated, this, &BitcoinGUI::setCurrentWallet);
activity->migrate(walletFrame->currentWalletModel());
Expand Down Expand Up @@ -650,7 +650,8 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH

m_mask_values_action->setChecked(_clientModel->getOptionsModel()->getOption(OptionsModel::OptionID::MaskValues).toBool());
} else {
if(trayIconMenu)
// Shutdown requested, disable menus
if (trayIconMenu)
{
hebasto marked this conversation as resolved.
Show resolved Hide resolved
// Disable context menu on tray icon
trayIconMenu->clear();
Expand All @@ -664,6 +665,8 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
}
#endif // ENABLE_WALLET
unitDisplayControl->setOptionsModel(nullptr);
// Disable top bar menu actions
appMenuBar->clear();
}
}

Expand Down