|
|
34a24a |
From bb381997525a1ff74f1bbac3556d566b62f3ef1b Mon Sep 17 00:00:00 2001
|
|
|
34a24a |
From: Ray Strode <rstrode@redhat.com>
|
|
|
34a24a |
Date: Wed, 27 Sep 2017 10:41:47 -0400
|
|
|
34a24a |
Subject: [PATCH 02/13] lib: leak fix
|
|
|
34a24a |
|
|
|
34a24a |
If a new user is added by accounts service, we currently leak
|
|
|
34a24a |
a reference to it. That leads to transient user objects living
|
|
|
34a24a |
longer than they're supposed which uses memory and produces
|
|
|
34a24a |
excess bus traffic.
|
|
|
34a24a |
---
|
|
|
34a24a |
src/libaccountsservice/act-user-manager.c | 5 ++++-
|
|
|
34a24a |
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
34a24a |
|
|
|
34a24a |
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
|
|
|
34a24a |
index d866725..c8d0443 100644
|
|
|
34a24a |
--- a/src/libaccountsservice/act-user-manager.c
|
|
|
34a24a |
+++ b/src/libaccountsservice/act-user-manager.c
|
|
|
34a24a |
@@ -1088,68 +1088,71 @@ add_new_user_for_object_path (const char *object_path,
|
|
|
34a24a |
user = g_hash_table_lookup (manager->priv->users_by_object_path, object_path);
|
|
|
34a24a |
|
|
|
34a24a |
if (user != NULL) {
|
|
|
34a24a |
g_debug ("ActUserManager: tracking existing %s with object path %s",
|
|
|
34a24a |
describe_user (user), object_path);
|
|
|
34a24a |
return user;
|
|
|
34a24a |
}
|
|
|
34a24a |
|
|
|
34a24a |
user = find_new_user_with_object_path (manager, object_path);
|
|
|
34a24a |
|
|
|
34a24a |
if (user != NULL) {
|
|
|
34a24a |
g_debug ("ActUserManager: tracking existing (but very recently added) %s with object path %s",
|
|
|
34a24a |
describe_user (user), object_path);
|
|
|
34a24a |
return user;
|
|
|
34a24a |
}
|
|
|
34a24a |
|
|
|
34a24a |
g_debug ("ActUserManager: tracking new user with object path %s", object_path);
|
|
|
34a24a |
|
|
|
34a24a |
user = create_new_user (manager);
|
|
|
34a24a |
_act_user_update_from_object_path (user, 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 |
- add_new_user_for_object_path (object_path, manager);
|
|
|
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 |
|
|
|
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 |
|
|
|
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 |
--
|
|
|
34a24a |
2.14.1
|
|
|
34a24a |
|