fix(qt): don't crash in options when running with -disablewallet

This commit is contained in:
UdjinM6 2023-06-10 22:59:24 +03:00
parent d53e657513
commit fba5d06a8c
2 changed files with 9 additions and 5 deletions

View File

@ -38,7 +38,8 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
ui(new Ui::OptionsDialog),
model(nullptr),
mapper(nullptr),
pageButtons(nullptr)
pageButtons(nullptr),
m_enable_wallet(enableWallet)
{
ui->setupUi(this);
@ -108,7 +109,7 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
pageButtons = new QButtonGroup(this);
pageButtons->addButton(ui->btnMain, pageButtons->buttons().size());
/* Remove Wallet/CoinJoin tabs and 3rd party-URL textbox in case of -disablewallet */
if (!enableWallet) {
if (!m_enable_wallet) {
ui->stackedWidgetOptions->removeWidget(ui->pageWallet);
ui->btnWallet->hide();
ui->stackedWidgetOptions->removeWidget(ui->pageCoinJoin);
@ -396,10 +397,12 @@ void OptionsDialog::on_okButton_clicked()
mapper->submit();
appearance->accept();
#ifdef ENABLE_WALLET
if (m_enable_wallet) {
for (auto& wallet : model->node().walletClient().getWallets()) {
wallet->coinJoin().resetCachedBlocks();
wallet->markDirty();
}
}
#endif // ENABLE_WALLET
accept();
updateDefaultProxyNets();

View File

@ -89,6 +89,7 @@ private:
QString previousTheme;
AppearanceWidget* appearance;
bool fCoinJoinEnabledPrev{false};
bool m_enable_wallet{false};
void showEvent(QShowEvent* event) override;
};