[gdm] Fix gdm_user_manager_get_user



commit 97b693497806e5436d832ba3a66c6810546d6478
Author: Ray Strode <rstrode redhat com>
Date:   Tue Sep 7 17:04:51 2010 -0400

    Fix gdm_user_manager_get_user
    
    Before it was assuming that as soon as a user was added, it would be
    in the hash table of loaded users. That's no longer true, now that
    the user is loaded asynchronously.

 gui/simple-greeter/gdm-user-manager.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-user-manager.c b/gui/simple-greeter/gdm-user-manager.c
index 138fbb6..4382481 100644
--- a/gui/simple-greeter/gdm-user-manager.c
+++ b/gui/simple-greeter/gdm-user-manager.c
@@ -819,24 +819,27 @@ on_new_user_loaded (GdmUser        *user,
         }
 }
 
-static void
+static GdmUser *
 add_new_user_for_object_path (const char     *object_path,
                               GdmUserManager *manager)
 {
         GdmUser *user;
 
-        if (g_hash_table_lookup (manager->priv->users_by_object_path, object_path)) {
-                return;
+        user = g_hash_table_lookup (manager->priv->users_by_object_path, object_path); 
+
+        if (user != NULL) {
+                return user;
         }
         user = gdm_user_new_from_object_path (object_path);
 
         if (user == NULL) {
-                return;
+                return NULL;
         }
 
         manager->priv->new_users = g_slist_prepend (manager->priv->new_users, user);
 
         g_signal_connect (user, "notify::is-loaded", G_CALLBACK (on_new_user_loaded), manager);
+        return user;
 }
 
 static void
@@ -1563,9 +1566,8 @@ gdm_user_manager_get_user (GdmUserManager *manager,
                         object_path = get_user_object_path_from_accounts_service (manager, username);
 
                         if (object_path != NULL) {
-                                add_new_user_for_object_path (object_path, manager);
+                                user = add_new_user_for_object_path (object_path, manager);
                                 g_free (object_path);
-                                user = g_hash_table_lookup (manager->priv->users_by_name, username);
                         }
                 } else {
                         struct passwd *pwent;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]