[gnome-settings-daemon] xrandr: Don't operate on a NULL object



commit 92b5f78720c788e730d17b40f5ec52e129aa8bee
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jan 23 05:52:50 2013 -0500

    xrandr: Don't operate on a NULL object
    
    I see a critical out of gnome_rr_config_set_clone in my session log.
    It turns out all uses of that function in the xrandr plugin are
    happening after possibly nulling the GnomeRRConfig they are operating
    on.
    
    This commit ensures the clone state is set immediately after creating
    the object to correct that.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=692372

 plugins/xrandr/gsd-xrandr-manager.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index ce552a7..2fb6204 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -880,6 +880,8 @@ make_clone_setup (GsdXrandrManager *manager, GnomeRRScreen *screen)
                 return NULL;
 
         result = gnome_rr_config_new_current (screen, NULL);
+        gnome_rr_config_set_clone (result, TRUE);
+
         outputs = gnome_rr_config_get_outputs (result);
 
         for (i = 0; outputs[i] != NULL; ++i) {
@@ -921,8 +923,6 @@ make_clone_setup (GsdXrandrManager *manager, GnomeRRScreen *screen)
                 result = NULL;
         }
 
-        gnome_rr_config_set_clone (result, TRUE);
-
         print_configuration (result, "clone setup");
 
         return result;
@@ -1004,6 +1004,8 @@ make_laptop_setup (GsdXrandrManager *manager, GnomeRRScreen *screen)
         GnomeRROutputInfo **outputs = gnome_rr_config_get_outputs (result);
         int i;
 
+        gnome_rr_config_set_clone (result, FALSE);
+
         for (i = 0; outputs[i] != NULL; ++i) {
                 GnomeRROutputInfo *info = outputs[i];
 
@@ -1019,13 +1021,12 @@ make_laptop_setup (GsdXrandrManager *manager, GnomeRRScreen *screen)
                 }
         }
 
+
         if (config_is_all_off (result)) {
                 g_object_unref (G_OBJECT (result));
                 result = NULL;
         }
 
-        gnome_rr_config_set_clone (result, FALSE);
-
         print_configuration (result, "Laptop setup");
 
         /* FIXME - Maybe we should return NULL if there is more than
@@ -1146,6 +1147,8 @@ make_xinerama_setup (GsdXrandrManager *manager, GnomeRRScreen *screen)
         int i;
         int x;
 
+        gnome_rr_config_set_clone (result, FALSE);
+
         x = 0;
         for (i = 0; outputs[i] != NULL; ++i) {
                 GnomeRROutputInfo *info = outputs[i];
@@ -1174,8 +1177,6 @@ make_xinerama_setup (GsdXrandrManager *manager, GnomeRRScreen *screen)
                 result = NULL;
         }
 
-        gnome_rr_config_set_clone (result, FALSE);
-
         print_configuration (result, "xinerama setup");
 
         return result;
@@ -1192,6 +1193,8 @@ make_other_setup (GnomeRRScreen *screen)
         GnomeRROutputInfo **outputs = gnome_rr_config_get_outputs (result);
         int i;
 
+        gnome_rr_config_set_clone (result, FALSE);
+
         for (i = 0; outputs[i] != NULL; ++i) {
                 GnomeRROutputInfo *info = outputs[i];
 
@@ -1209,8 +1212,6 @@ make_other_setup (GnomeRRScreen *screen)
                 result = NULL;
         }
 
-        gnome_rr_config_set_clone (result, FALSE);
-
         print_configuration (result, "other setup");
 
         return result;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]