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

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