[gnome-settings-daemon/gnome-3-14] xrandr: Register our DBus API only after all other initialization



commit e4b1d27d5d1df77301a5c018ddfb086e4da9e8e4
Author: Rui Matos <tiagomatos gmail com>
Date:   Fri Nov 14 23:27:54 2014 +0100

    xrandr: Register our DBus API only after all other initialization
    
    Otherwise we risk being called and not have all out internal state
    ready (e.g. priv->rw_screen being NULL) leading to crashes.
    
    We also need to disown our well known name on stop() since we'll
    reaquire it if start() gets called again.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=740151

 plugins/xrandr/gsd-xrandr-manager.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index 007beab..67b3ed1 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -129,6 +129,7 @@ static void get_allowed_rotations_for_output (GnomeRRConfig *config,
                                               GnomeRRRotation *out_rotations);
 static void handle_fn_f7 (GsdXrandrManager *mgr, gint64 timestamp);
 static void handle_rotate_windows (GsdXrandrManager *mgr, GnomeRRRotation rotation, gint64 timestamp);
+static void register_manager_dbus (GsdXrandrManager *manager);
 
 G_DEFINE_TYPE (GsdXrandrManager, gsd_xrandr_manager, G_TYPE_OBJECT)
 
@@ -1232,6 +1233,7 @@ on_rr_screen_acquired (GObject      *object,
         manager->priv->settings = g_settings_new (CONF_SCHEMA);
 
         manager_init_devices (manager);
+        register_manager_dbus (manager);
 
         log_close ();
 }
@@ -1283,6 +1285,9 @@ gsd_xrandr_manager_stop (GsdXrandrManager *manager)
                 manager->priv->upower_client = NULL;
         }
 
+        if (manager->priv->name_id != 0)
+                g_bus_unown_name (manager->priv->name_id);
+
         if (manager->priv->introspection_data) {
                 g_dbus_node_info_unref (manager->priv->introspection_data);
                 manager->priv->introspection_data = NULL;
@@ -1341,9 +1346,6 @@ gsd_xrandr_manager_finalize (GObject *object)
 
         gsd_xrandr_manager_stop (manager);
 
-        if (manager->priv->name_id != 0)
-                g_bus_unown_name (manager->priv->name_id);
-
         G_OBJECT_CLASS (gsd_xrandr_manager_parent_class)->finalize (object);
 }
 
@@ -1462,8 +1464,6 @@ gsd_xrandr_manager_new (void)
                 manager_object = g_object_new (GSD_TYPE_XRANDR_MANAGER, NULL);
                 g_object_add_weak_pointer (manager_object,
                                            (gpointer *) &manager_object);
-
-                register_manager_dbus (manager_object);
         }
 
         return GSD_XRANDR_MANAGER (manager_object);


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