Blame SOURCES/0003-lib-another-leak-fix.patch

34a24a
From 889561310b794f0443dc5c520b09151fe4b260ec Mon Sep 17 00:00:00 2001
34a24a
From: Ray Strode <rstrode@redhat.com>
34a24a
Date: Wed, 27 Sep 2017 10:43:33 -0400
34a24a
Subject: [PATCH 03/13] lib: another leak fix
34a24a
34a24a
If a user gets removed from account service before it's fully loaded,
34a24a
then we neglect to drop its reference on the new_users lists.
34a24a
34a24a
This commit fixes that.
34a24a
---
34a24a
 src/libaccountsservice/act-user-manager.c | 8 +++++++-
34a24a
 1 file changed, 7 insertions(+), 1 deletion(-)
34a24a
34a24a
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
34a24a
index c8d0443..ac06e24 100644
34a24a
--- a/src/libaccountsservice/act-user-manager.c
34a24a
+++ b/src/libaccountsservice/act-user-manager.c
34a24a
@@ -1108,71 +1108,77 @@ add_new_user_for_object_path (const char     *object_path,
34a24a
 
34a24a
         return user;
34a24a
 }
34a24a
 
34a24a
 static void
34a24a
 on_new_user_in_accounts_service (GDBusProxy *proxy,
34a24a
                                  const char *object_path,
34a24a
                                  gpointer    user_data)
34a24a
 {
34a24a
         ActUserManager *manager = ACT_USER_MANAGER (user_data);
34a24a
         ActUser *user;
34a24a
 
34a24a
         if (!manager->priv->is_loaded) {
34a24a
                 g_debug ("ActUserManager: ignoring new user in accounts service with object path %s since not loaded yet", object_path);
34a24a
                 return;
34a24a
         }
34a24a
 
34a24a
         g_debug ("ActUserManager: new user in accounts service with object path %s", object_path);
34a24a
         user = add_new_user_for_object_path (object_path, manager);
34a24a
 
34a24a
         g_object_unref (user);
34a24a
 }
34a24a
 
34a24a
 static void
34a24a
 on_user_removed_in_accounts_service (GDBusProxy *proxy,
34a24a
                                      const char *object_path,
34a24a
                                      gpointer    user_data)
34a24a
 {
34a24a
         ActUserManager *manager = ACT_USER_MANAGER (user_data);
34a24a
         ActUser        *user;
34a24a
+        GSList         *node;
34a24a
 
34a24a
         user = g_hash_table_lookup (manager->priv->users_by_object_path, object_path);
34a24a
 
34a24a
         if (user == NULL) {
34a24a
                 g_debug ("ActUserManager: ignoring untracked user %s", object_path);
34a24a
                 return;
34a24a
         } else {
34a24a
                 g_debug ("ActUserManager: tracked user %s removed from accounts service", object_path);
34a24a
         }
34a24a
 
34a24a
-        manager->priv->new_users = g_slist_remove (manager->priv->new_users, user);
34a24a
+        node = g_slist_find (manager->priv->new_users, user);
34a24a
+        if (node != NULL) {
34a24a
+                g_signal_handlers_disconnect_by_func (user, on_new_user_loaded, manager);
34a24a
+                g_object_unref (user);
34a24a
+                manager->priv->new_users = g_slist_delete_link (manager->priv->new_users, node);
34a24a
+        }
34a24a
 
34a24a
         remove_user (manager, user);
34a24a
 }
34a24a
 
34a24a
 static void
34a24a
 on_get_current_session_finished (GObject        *object,
34a24a
                                  GAsyncResult   *result,
34a24a
                                  gpointer        data)
34a24a
 {
34a24a
         ConsoleKitManager *proxy = CONSOLE_KIT_MANAGER (object);
34a24a
         ActUserManager    *manager = data;
34a24a
         GError            *error = NULL;
34a24a
         char              *session_id;
34a24a
 
34a24a
         g_assert (manager->priv->seat.state == ACT_USER_MANAGER_SEAT_STATE_GET_SESSION_ID);
34a24a
 
34a24a
         if (!console_kit_manager_call_get_current_session_finish (proxy, &session_id, result, &error)) {
34a24a
                 if (error != NULL) {
34a24a
                         g_debug ("Failed to identify the current session: %s",
34a24a
                                  error->message);
34a24a
                         g_error_free (error);
34a24a
                 } else {
34a24a
                         g_debug ("Failed to identify the current session");
34a24a
                 }
34a24a
                 unload_seat (manager);
34a24a
 
34a24a
                 goto out;
34a24a
         }
34a24a
 
34a24a
         manager->priv->seat.session_id = session_id;
34a24a
-- 
34a24a
2.14.1
34a24a