[gnome-control-center/gnome-3-36] user-panel: Add reference to selected user and clear on dispose



commit 689aee32920d5228ee79b72889182ffbc2796212
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Thu Mar 26 06:41:33 2020 +0100

    user-panel: Add reference to selected user and clear on dispose
    
    The object was wrongly unreffed (as ActUserManager has the ownership) on
    user switch, so add a reference instead when assigning it to our private
    ref and unref it on dispose.

 panels/user-accounts/cc-user-panel.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/panels/user-accounts/cc-user-panel.c b/panels/user-accounts/cc-user-panel.c
index ee9cccd14..bde10675f 100644
--- a/panels/user-accounts/cc-user-panel.c
+++ b/panels/user-accounts/cc-user-panel.c
@@ -174,10 +174,9 @@ set_selected_user (CcUserPanel *self, CcCarouselItem *item)
 {
         uid_t uid;
 
-        g_clear_object (&self->selected_user);
-
         uid = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "uid"));
-        self->selected_user = act_user_manager_get_user_by_id (self->um, uid);
+        g_set_object (&self->selected_user,
+                      act_user_manager_get_user_by_id (self->um, uid));
 
         if (self->selected_user != NULL) {
                 show_user (self->selected_user, self);
@@ -1474,6 +1473,8 @@ cc_user_panel_dispose (GObject *object)
 {
         CcUserPanel *self = CC_USER_PANEL (object);
 
+        g_clear_object (&self->selected_user);
+
         g_clear_object (&self->login_screen_settings);
 
         g_clear_pointer ((GtkWidget **)&self->language_chooser, gtk_widget_destroy);


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