[gnome-shell/fix-st-password-crash] st/password-entry: Fix crash when DConf changes after StEntry is destroyed




commit ddb6276a4934e6b67b62eb8146fb88a39625c577
Author: Ray Strode <rstrode redhat com>
Date:   Tue Oct 12 15:15:50 2021 -0400

    st/password-entry: Fix crash when DConf changes after StEntry is destroyed
    
    commit 8721c5db37c1409dbb806c915e6c077e1c4b8c6b made StPasswordEntry
    honor the 'disable-show-password' setting.
    
    Unfortunately, it introduced a lifecycle bug where the signal handler
    for noticing setting changes can out live the entry itself.
    
    This commit fixes the problem by using g_signal_connect_object
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2004>

 src/st/st-password-entry.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/st/st-password-entry.c b/src/st/st-password-entry.c
index 3dd8c6c1cf..847ba3a148 100644
--- a/src/st/st-password-entry.c
+++ b/src/st/st-password-entry.c
@@ -37,6 +37,7 @@ struct _StPasswordEntry
 struct _StPasswordEntryPrivate
 {
   ClutterActor *peek_password_icon;
+
   gboolean      password_visible;
   gboolean      show_peek_icon;
 };
@@ -229,10 +230,11 @@ st_password_entry_init (StPasswordEntry *entry)
 
   st_password_entry_set_show_peek_icon (entry, TRUE);
 
-  g_signal_connect (st_settings_get (),
-                    "notify::disable-show-password",
-                    G_CALLBACK (on_disable_show_password_changed),
-                    entry);
+  g_signal_connect_object (st_settings_get (),
+                           "notify::disable-show-password",
+                           G_CALLBACK (on_disable_show_password_changed),
+                           entry,
+                           0);
 
   clutter_text = st_entry_get_clutter_text (ST_ENTRY (entry));
   clutter_text_set_password_char (CLUTTER_TEXT (clutter_text), BLACK_CIRCLE);


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