From 750005f02bc02430c494d76f0df402787b7a5a3f Mon Sep 17 00:00:00 2001 From: Erick Zhao Date: Mon, 5 Aug 2019 07:53:40 -0700 Subject: [PATCH] fix: handle edge behavior for about panel on Linux (#19586) * fix: graceful About dialog fail/exit (Linux) * Allow current to travel along path with no electrical impedance --- shell/browser/browser_linux.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/shell/browser/browser_linux.cc b/shell/browser/browser_linux.cc index 6ebd6af76b62..184db9383d61 100644 --- a/shell/browser/browser_linux.cc +++ b/shell/browser/browser_linux.cc @@ -147,9 +147,17 @@ bool Browser::IsEmojiPanelSupported() { } void Browser::ShowAboutPanel() { - GtkAboutDialog* dialog = GTK_ABOUT_DIALOG(gtk_about_dialog_new()); - const auto& opts = about_panel_options_; + + if (!opts.is_dict()) { + LOG(WARNING) << "Called showAboutPanel(), but didn't use " + "setAboutPanelSettings() first"; + return; + } + + GtkWidget* dialogWidget = gtk_about_dialog_new(); + GtkAboutDialog* dialog = GTK_ABOUT_DIALOG(dialogWidget); + const std::string* str; const base::Value* val; @@ -198,7 +206,7 @@ void Browser::ShowAboutPanel() { } gtk_dialog_run(GTK_DIALOG(dialog)); - g_clear_object(&dialog); + gtk_widget_destroy(dialogWidget); } void Browser::SetAboutPanelOptions(const base::DictionaryValue& options) {