[gnome-control-center/gnome-3-22] user-accounts: Fix crash when name is changed and dialogue closed



commit 17722124eaaba564c9ad69a2239da6601286c964
Author: Ondrej Holy <oholy redhat com>
Date:   Wed Feb 15 08:58:43 2017 +0100

    user-accounts: Fix crash when name is changed and dialogue closed
    
    Wrong variables are used to store timeout id, consequently, the sources
    are not properly removed in all cases. Then the dialog may crash in certain
    cases if it is closed before the source functions are called.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=778595

 panels/user-accounts/um-account-dialog.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/panels/user-accounts/um-account-dialog.c b/panels/user-accounts/um-account-dialog.c
index c0dcf1b..f341489 100644
--- a/panels/user-accounts/um-account-dialog.c
+++ b/panels/user-accounts/um-account-dialog.c
@@ -384,7 +384,7 @@ on_username_changed (GtkComboBoxText *combo,
 static gboolean
 local_name_timeout (UmAccountDialog *self)
 {
-        self->local_username_timeout_id = 0;
+        self->local_name_timeout_id = 0;
 
         dialog_validate (self);
 
@@ -429,10 +429,15 @@ on_name_changed (GtkEditable *editable,
                 gtk_combo_box_set_active (GTK_COMBO_BOX (self->local_username), 0);
         }
 
+        if (self->local_name_timeout_id != 0) {
+                g_source_remove (self->local_name_timeout_id);
+                self->local_name_timeout_id = 0;
+        }
+
         clear_entry_validation_error (GTK_ENTRY (editable));
         gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, FALSE);
 
-        self->local_username_timeout_id = g_timeout_add (PASSWORD_CHECK_TIMEOUT, (GSourceFunc) 
local_name_timeout, self);
+        self->local_name_timeout_id = g_timeout_add (PASSWORD_CHECK_TIMEOUT, (GSourceFunc) 
local_name_timeout, self);
 }
 
 static void


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