[gnome-settings-daemon] power: Fix crasher when lid was not present



commit dcf8dc956b050dc0e246d48ee7365d88a8f09357
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Apr 17 16:49:03 2013 +0200

    power: Fix crasher when lid was not present
    
    When the lid isn't present, we still need the GnomeRRScreen
    for backlight control.
    
    Spotted by Colin Walters

 plugins/power/gsd-power-manager.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index abfb6f4..e141be5 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -3421,12 +3421,10 @@ gsd_power_manager_start (GsdPowerManager *manager,
                 manager->priv->lid_is_closed = up_client_get_lid_is_closed (manager->priv->up_client);
 
         /* coldplug the list of screens */
-        if (manager->priv->lid_is_present) {
-                manager->priv->rr_screen = gnome_rr_screen_new (gdk_screen_get_default (), error);
-                if (manager->priv->rr_screen == NULL) {
-                        g_debug ("Lid is present and couldn't detect any screens, disabling plugin");
-                        return FALSE;
-                }
+        manager->priv->rr_screen = gnome_rr_screen_new (gdk_screen_get_default (), error);
+        if (manager->priv->rr_screen == NULL) {
+                g_debug ("Couldn't detect any screens, disabling plugin");
+                return FALSE;
         }
 
         /* Check for XTEST support */
@@ -3550,7 +3548,7 @@ gsd_power_manager_start (GsdPowerManager *manager,
         manager->priv->idle_monitor = gnome_idle_monitor_new ();
 
         /* set up the screens */
-        if (manager->priv->rr_screen) {
+        if (manager->priv->lid_is_present) {
                 g_signal_connect (manager->priv->rr_screen, "changed", G_CALLBACK (on_randr_event), manager);
                 watch_external_monitor (manager->priv->rr_screen);
                 on_randr_event (manager->priv->rr_screen, manager);


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