[gnome-control-center/wip/oholy/password-crashes] user-accounts: Fix crash when password dialog is cancelled



commit 76b03ca858fc93aea1c9454d4af698dab14addea
Author: Ondrej Holy <oholy redhat com>
Date:   Fri Jun 7 09:52:42 2019 +0200

    user-accounts: Fix crash when password dialog is cancelled
    
    If "Esc" is pressed, the callbacks to handle the `focus-out` signal are
    called after the `cc_password_dialog_dispose` function. This leads to
    segfaults, because the `user` variable is already cleared. Let's simply
    do not continue if `user == NULL` to fix those crashes.
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/563

 panels/user-accounts/cc-password-dialog.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/panels/user-accounts/cc-password-dialog.c b/panels/user-accounts/cc-password-dialog.c
index 449b1b1a3..9476a8be5 100644
--- a/panels/user-accounts/cc-password-dialog.c
+++ b/panels/user-accounts/cc-password-dialog.c
@@ -324,7 +324,8 @@ password_entry_focus_out_cb (CcPasswordDialog *self)
                 self->password_entry_timeout_id = 0;
         }
 
-        password_entry_timeout (self);
+        if (self->user != NULL)
+                password_entry_timeout (self);
 
         return FALSE;
 }
@@ -382,7 +383,8 @@ old_password_entry_focus_out_cb (CcPasswordDialog *self)
                 self->old_password_entry_timeout_id = 0;
         }
 
-        old_password_entry_timeout (self);
+        if (self->user != NULL)
+                old_password_entry_timeout (self);
 
         return FALSE;
 }


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