From 75cb96d077c488d9d3e86cc5e9b30587a4ef34cd Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Thu, 26 Mar 2015 16:01:04 +0100 Subject: display: Close the dialog when the RR configuration changes We assume that the RR configuration is valid in various callbacks from both our modal dialogs which doesn't hold if there's an hotplug while a dialog is open (e.g. monitor is plugged/unplugged). Closing the dialog in that case seems the right thing to do since it would be operating on an outdated view of the world otherwise and likely end up crashing. https://bugzilla.gnome.org/show_bug.cgi?id=655041 --- panels/display/cc-display-panel.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'panels') diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c index 98e89cdf3..5ee8249f1 100644 --- a/panels/display/cc-display-panel.c +++ b/panels/display/cc-display-panel.c @@ -391,6 +391,9 @@ on_screen_changed (CcDisplayPanel *panel) GtkSizeGroup *sizegroup; GList *sorted_outputs = NULL, *l; + if (priv->dialog) + gtk_dialog_response (GTK_DIALOG (priv->dialog), GTK_RESPONSE_NONE); + gnome_rr_screen_refresh (priv->screen, NULL); current = gnome_rr_config_new_current (priv->screen, NULL); @@ -1569,12 +1572,7 @@ show_arrange_displays_dialog (GtkButton *button, response = gtk_dialog_run (GTK_DIALOG (priv->dialog)); if (response == GTK_RESPONSE_ACCEPT) apply_current_configuration (panel); - else if (response == GTK_RESPONSE_NONE) - { - /* panel is being destroyed */ - return; - } - else + else if (response != GTK_RESPONSE_NONE) { /* re-read the previous configuration */ on_screen_changed (panel); @@ -2299,12 +2297,7 @@ show_setup_dialog (CcDisplayPanel *panel) apply_current_configuration (panel); } - else if (response == GTK_RESPONSE_NONE) - { - /* panel is being destroyed */ - return; - } - else + else if (response != GTK_RESPONSE_NONE) { /* changes cancelled, so re-read the current configuration */ on_screen_changed (panel); -- cgit v1.2.1