From 7cda32d49ec6988f0a54d7df82e1f0b91715f6bb Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 4 Sep 2020 12:52:03 +0100 Subject: [PATCH] Use GtkPasswordEntryBuffer in GtkPasswordEntry Now that we have a secure buffer, we should start using it. Fixed: #3119 --- gtk/gtkpasswordentry.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gtk/gtkpasswordentry.c b/gtk/gtkpasswordentry.c index 252b8be0f2..dfef768135 100644 --- a/gtk/gtkpasswordentry.c +++ b/gtk/gtkpasswordentry.c @@ -24,15 +24,16 @@ #include "gtktextprivate.h" #include "gtkeditable.h" +#include "gtkeventcontrollerkey.h" #include "gtkgestureclick.h" #include "gtkbox.h" #include "gtkimage.h" #include "gtkintl.h" -#include "gtkprivate.h" -#include "gtkwidgetprivate.h" #include "gtkmarshalers.h" +#include "gtkpasswordentrybufferprivate.h" +#include "gtkprivate.h" #include "gtkstylecontext.h" -#include "gtkeventcontrollerkey.h" +#include "gtkwidgetprivate.h" /** * SECTION:gtkpasswordentry @@ -159,8 +160,10 @@ static void gtk_password_entry_init (GtkPasswordEntry *entry) { GtkPasswordEntryPrivate *priv = gtk_password_entry_get_instance_private (entry); + GtkEntryBuffer *buffer = gtk_password_entry_buffer_new (); priv->entry = gtk_text_new (); + gtk_text_set_buffer (GTK_TEXT (priv->entry), buffer); gtk_text_set_visibility (GTK_TEXT (priv->entry), FALSE); gtk_widget_set_parent (priv->entry, GTK_WIDGET (entry)); gtk_editable_init_delegate (GTK_EDITABLE (entry)); @@ -175,6 +178,9 @@ gtk_password_entry_init (GtkPasswordEntry *entry) gtk_widget_add_css_class (GTK_WIDGET (entry), I_("password")); gtk_password_entry_set_extra_menu (entry, NULL); + + /* Transfer ownership to the GtkText widget */ + g_object_unref (buffer); } static void