[gnome-settings-daemon/gnome-3-6] power: Avoid crasher if XRandR calls fail on startup



commit 650ad58acab0d87f2a13bc49965454603be68431
Author: Richard Hughes <richard hughsie com>
Date:   Wed Dec 5 14:11:53 2012 +0100

    power: Avoid crasher if XRandR calls fail on startup
    
    In between a start()/stop() pairing, if gnome_rr_screen_new()
    somehow returns NULL, exit the start() function earlier, before
    anything is set up. This helps avoid a crash where the x11_screen
    could be used by just-set-up signals.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=672245

 plugins/power/gsd-power-manager.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index f936de3..4181a4a 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -3802,6 +3802,11 @@ gsd_power_manager_start (GsdPowerManager *manager,
         g_debug ("Starting power manager");
         gnome_settings_profile_start (NULL);
 
+        /* coldplug the list of screens */
+        manager->priv->x11_screen = gnome_rr_screen_new (gdk_screen_get_default (), error);
+        if (manager->priv->x11_screen == NULL)
+                return FALSE;
+
         /* track the active session */
         manager->priv->session = gnome_settings_session_new ();
         g_signal_connect (manager->priv->session, "notify::state",
@@ -3929,11 +3934,6 @@ gsd_power_manager_start (GsdPowerManager *manager,
         g_signal_connect (manager->priv->idletime, "alarm-expired",
                           G_CALLBACK (idle_idletime_alarm_expired_cb), manager);
 
-        /* coldplug the list of screens */
-        manager->priv->x11_screen = gnome_rr_screen_new (gdk_screen_get_default (), error);
-        if (manager->priv->x11_screen == NULL)
-                return FALSE;
-
         /* ensure the default dpms timeouts are cleared */
         ret = gnome_rr_screen_set_dpms_mode (manager->priv->x11_screen,
                                              GNOME_RR_DPMS_ON,



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