diff options
author | Ondrej Holy <oholy@redhat.com> | 2017-02-15 08:58:43 +0100 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2017-02-16 09:23:21 +0100 |
commit | 17722124eaaba564c9ad69a2239da6601286c964 (patch) | |
tree | e1e54138a7412fcd2c166ae600ec8690b7ae3c70 | |
parent | 925f66cd0a9623d78b9d3025013c950ccba53ac8 (diff) | |
download | gnome-control-center-17722124eaaba564c9ad69a2239da6601286c964.tar.gz |
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
-rw-r--r-- | 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 c0dcf1be1..f34148943 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 |