user-selector: Purge items after listing users

The first call to act_user_manager_list_users() may lazily load
and notify the 'is-loaded' property, in which case we end up
indirectly recursing into reload_users(). Because we recurse
*after* purging carousel items, the same user is added twice:
once in the leaf recursion call, and once again in the call that
notified the 'is-loaded' property.

A simple workaround to this is purging carousel items after the
call to act_user_manager_list_users().
This commit is contained in:
Georges Basile Stavracas Neto 2022-07-15 17:00:49 -03:00
parent b5e516bea0
commit a4ac1d644d
1 changed files with 2 additions and 2 deletions

View File

@ -370,11 +370,11 @@ reload_users (MctUserSelector *self,
g_object_get (settings, "gtk-enable-animations", &animations, NULL);
g_object_set (settings, "gtk-enable-animations", FALSE, NULL);
mct_carousel_purge_items (self->carousel);
list = act_user_manager_list_users (self->user_manager);
g_debug ("Got %u users", g_slist_length (list));
mct_carousel_purge_items (self->carousel);
list = g_slist_sort (list, (GCompareFunc) sort_users);
for (l = list; l; l = l->next)
{