From 38de654eea40fb559dc67467900cc7e890347ce6 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Wed, 11 Mar 2009 15:14:11 +0000 Subject: [PATCH] bgo574865 (RANDR) - Don't leave a dangling pointer for the current_output when the RANDR configuration changes Signed-off-by: Federico Mena Quintero svn path=/trunk/; revision=9339 --- capplets/display/ChangeLog | 13 +++++++++++++ capplets/display/xrandr-capplet.c | 12 ++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/capplets/display/ChangeLog b/capplets/display/ChangeLog index 0d43f45c3..4bdc6b64c 100644 --- a/capplets/display/ChangeLog +++ b/capplets/display/ChangeLog @@ -1,3 +1,16 @@ +2009-03-11 Federico Mena Quintero + + http://bugzilla.gnome.org/show_bug.cgi?id=574865 - Crash when + refreshing the RANDR configuration. + + * xrandr-capplet.c (select_current_output_from_dialog_position): + Always set app->current_output; otherwise we could be left with a + dangling pointer to the old current_output (which is invalid after + refreshing the current_configuration). + (on_screen_changed): Null out the current_output when we get a new + RANDR configuration, as it will become obsolete as soon as we free + the old configuration. + 2009-03-11 Gabor Kelemen * xrandr-capplet.c: Make the strings of the Rotation dialog appear diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c index e46b88ad2..4262e54ba 100644 --- a/capplets/display/xrandr-capplet.c +++ b/capplets/display/xrandr-capplet.c @@ -130,6 +130,7 @@ on_screen_changed (GnomeRRScreen *scr, gnome_rr_config_free (app->current_configuration); app->current_configuration = current; + app->current_output = NULL; #if 0 for (i = 0; app->current_configuration->outputs[i] != NULL; ++i) @@ -1944,14 +1945,9 @@ static void select_current_output_from_dialog_position (App *app) { if (GTK_WIDGET_REALIZED (app->dialog)) - { - GnomeOutputInfo *output; - - output = get_output_for_window (app->current_configuration, app->dialog->window); - - if (output) - app->current_output = output; - } + app->current_output = get_output_for_window (app->current_configuration, app->dialog->window); + else + app->current_output = NULL; rebuild_gui (app); }