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

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