Blame SOURCES/0001-lib-move-g_object_ref-call-for-clarity.patch

baf615
From e1672162fc37c37fb09450991316fbfe22029882 Mon Sep 17 00:00:00 2001
baf615
From: Ray Strode <rstrode@redhat.com>
baf615
Date: Wed, 27 Sep 2017 10:39:05 -0400
baf615
Subject: [PATCH 01/13] lib: move g_object_ref call for clarity
baf615
baf615
create_new_user creates an ActUser object and returns it to
baf615
the caller.  Before returning the object, it also adds the
baf615
object to a list of "new users" to track when it fully loads.
baf615
baf615
It's idiomatic to return the original ref to the caller of
baf615
a constructor, but create_new_user instead gives the original
baf615
reference to the new_users list.  Their's no practical difference,
baf615
but this commit moves the ref around for clarity.
baf615
---
baf615
 src/libaccountsservice/act-user-manager.c | 4 ++--
baf615
 1 file changed, 2 insertions(+), 2 deletions(-)
baf615
baf615
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
baf615
index 914a1c9..d866725 100644
baf615
--- a/src/libaccountsservice/act-user-manager.c
baf615
+++ b/src/libaccountsservice/act-user-manager.c
baf615
@@ -816,65 +816,65 @@ static void
baf615
 add_session_for_user (ActUserManager *manager,
baf615
                       ActUser        *user,
baf615
                       const char     *ssid,
baf615
                       gboolean        is_ours)
baf615
 {
baf615
         g_hash_table_insert (manager->priv->sessions,
baf615
                              g_strdup (ssid),
baf615
                              g_object_ref (user));
baf615
 
baf615
         _act_user_add_session (user, ssid, is_ours);
baf615
         g_debug ("ActUserManager: added session for %s", describe_user (user));
baf615
 }
baf615
 
baf615
 static void
baf615
 set_has_multiple_users (ActUserManager *manager,
baf615
                         gboolean        has_multiple_users)
baf615
 {
baf615
         if (manager->priv->has_multiple_users != has_multiple_users) {
baf615
                 manager->priv->has_multiple_users = has_multiple_users;
baf615
                 g_object_notify (G_OBJECT (manager), "has-multiple-users");
baf615
         }
baf615
 }
baf615
 
baf615
 static ActUser *
baf615
 create_new_user (ActUserManager *manager)
baf615
 {
baf615
         ActUser *user;
baf615
 
baf615
         user = g_object_new (ACT_TYPE_USER, NULL);
baf615
 
baf615
-        manager->priv->new_users = g_slist_prepend (manager->priv->new_users, user);
baf615
+        manager->priv->new_users = g_slist_prepend (manager->priv->new_users, g_object_ref (user));
baf615
 
baf615
         g_signal_connect_object (user, "notify::is-loaded", G_CALLBACK (on_new_user_loaded), manager, 0);
baf615
 
baf615
-        return g_object_ref (user);
baf615
+        return user;
baf615
 }
baf615
 
baf615
 static void
baf615
 add_user (ActUserManager *manager,
baf615
           ActUser        *user)
baf615
 {
baf615
         const char *object_path;
baf615
 
baf615
         g_debug ("ActUserManager: tracking user '%s'", act_user_get_user_name (user));
baf615
         if (act_user_is_system_account (user)) {
baf615
                 g_hash_table_insert (manager->priv->system_users_by_name,
baf615
                                      g_strdup (act_user_get_user_name (user)),
baf615
                                      g_object_ref (user));
baf615
         } else {
baf615
                 g_hash_table_insert (manager->priv->normal_users_by_name,
baf615
                                      g_strdup (act_user_get_user_name (user)),
baf615
                                      g_object_ref (user));
baf615
         }
baf615
 
baf615
         object_path = act_user_get_object_path (user);
baf615
         if (object_path != NULL) {
baf615
                 g_hash_table_replace (manager->priv->users_by_object_path,
baf615
                                       (gpointer) object_path,
baf615
                                       g_object_ref (user));
baf615
         }
baf615
 
baf615
         g_signal_connect_object (user,
baf615
                                  "sessions-changed",
baf615
                                  G_CALLBACK (on_user_sessions_changed),
baf615
                                  manager, 0);
baf615
-- 
baf615
2.14.1
baf615