gnome-shell/0001-st-password-entry-Fix-crash-when-DConf-changes-after.patch

95 lines
3.3 KiB
Diff
Raw Normal View History

From de6604e4c7ddfcfd5fc089c462ecd29316b44189 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 12 Oct 2021 15:15:50 -0400
Subject: [PATCH] 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
---
src/st/st-password-entry.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/st/st-password-entry.c b/src/st/st-password-entry.c
index 3dd8c6c1c..d17eeefa4 100644
--- a/src/st/st-password-entry.c
+++ b/src/st/st-password-entry.c
@@ -202,64 +202,65 @@ on_disable_show_password_changed (GObject *object,
static void
clutter_text_password_char_cb (GObject *object,
GParamSpec *pspec,
gpointer user_data)
{
StPasswordEntry *entry = ST_PASSWORD_ENTRY (user_data);
ClutterActor *clutter_text;
clutter_text = st_entry_get_clutter_text (ST_ENTRY (entry));
if (clutter_text_get_password_char (CLUTTER_TEXT (clutter_text)) == 0)
st_password_entry_set_password_visible (entry, TRUE);
else
st_password_entry_set_password_visible (entry, FALSE);
}
static void
st_password_entry_init (StPasswordEntry *entry)
{
StPasswordEntryPrivate *priv = ST_PASSWORD_ENTRY_PRIV (entry);
ClutterActor *clutter_text;
priv->peek_password_icon = g_object_new (ST_TYPE_ICON,
"style-class", "peek-password",
"icon-name", "eye-not-looking-symbolic",
NULL);
st_entry_set_secondary_icon (ST_ENTRY (entry), priv->peek_password_icon);
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);
st_entry_set_input_purpose (ST_ENTRY (entry), CLUTTER_INPUT_CONTENT_PURPOSE_PASSWORD);
g_signal_connect (clutter_text, "notify::password-char",
G_CALLBACK (clutter_text_password_char_cb), entry);
}
/**
* st_password_entry_new:
*
* Create a new #StPasswordEntry.
*
* Returns: a new #StEntry
*/
StEntry*
st_password_entry_new (void)
{
return ST_ENTRY (g_object_new (ST_TYPE_PASSWORD_ENTRY, NULL));
}
/**
* st_password_entry_set_show_peek_icon:
* @entry: a #StPasswordEntry
* @value: %TRUE to show the peek-icon in the entry
*
* Sets whether to show or hide the peek-icon in the password entry. If %TRUE,
* a icon button for temporarily unmasking the password will be shown at the
--
2.31.1