From 1a4765d778c611c9dc2920518dd9622eec0fbd98 Mon Sep 17 00:00:00 2001 From: Mike Skec Date: Thu, 31 Dec 2020 18:59:04 +1100 Subject: Fix segfault when opening settings dialog with no tabs --- src/mainwindow.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5f2a7d2..f9266bc 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -291,21 +291,21 @@ void MainWindow::on_actionSettings_triggered() dialog.setHttpsSslTrust(kristall::trust::https); // We use this to disable url bar styling - // while we view settings, so that theme - // stays applied. - settings_visible = true; - this->curTab()->updateUrlBarStyle(); + // while we view Settings dialog, so that the URL bar + // doesn't look weird after changing theme. + static const auto update_url_style = [this](bool vis) { + this->settings_visible = vis; + if (this->curTab()) this->curTab()->updateUrlBarStyle(); + }; + update_url_style(true); if(dialog.exec() != QDialog::Accepted) { kristall::setTheme(kristall::options.theme); - - settings_visible = false; - this->curTab()->updateUrlBarStyle(); - + update_url_style(false); return; } - settings_visible = false; + update_url_style(false); kristall::trust::gemini = dialog.geminiSslTrust(); kristall::trust::https = dialog.httpsSslTrust(); -- cgit v1.2.3