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



commit 60c315b53ba9fb2fc0c8e85674d365c6d5a7ee4b
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 9d196db..ed5093e 100644
--- a/panels/user-accounts/um-account-dialog.c
+++ b/panels/user-accounts/um-account-dialog.c
@@ -393,7 +393,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);
 
@@ -439,10 +439,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]