Merge branch 'password-entry-unrealize' into 'main'

passwordentry: Fix an asymmetry

Closes #5285

See merge request GNOME/gtk!5457
This commit is contained in:
Matthias Clasen 2023-01-30 12:29:33 +00:00
commit 442cd4a369

View File

@ -250,14 +250,25 @@ gtk_password_entry_realize (GtkWidget *widget)
}
}
static void
gtk_password_entry_unrealize (GtkWidget *widget)
{
GtkPasswordEntry *entry = GTK_PASSWORD_ENTRY (widget);
if (entry->keyboard)
{
g_signal_handlers_disconnect_by_func (entry->keyboard, caps_lock_state_changed, entry);
entry->keyboard = NULL;
}
GTK_WIDGET_CLASS (gtk_password_entry_parent_class)->unrealize (widget);
}
static void
gtk_password_entry_dispose (GObject *object)
{
GtkPasswordEntry *entry = GTK_PASSWORD_ENTRY (object);
if (entry->keyboard)
g_signal_handlers_disconnect_by_func (entry->keyboard, caps_lock_state_changed, entry);
if (entry->entry)
gtk_editable_finish_delegate (GTK_EDITABLE (entry));
@ -448,6 +459,7 @@ gtk_password_entry_class_init (GtkPasswordEntryClass *klass)
object_class->set_property = gtk_password_entry_set_property;
widget_class->realize = gtk_password_entry_realize;
widget_class->unrealize = gtk_password_entry_unrealize;
widget_class->measure = gtk_password_entry_measure;
widget_class->size_allocate = gtk_password_entry_size_allocate;
widget_class->mnemonic_activate = gtk_password_entry_mnemonic_activate;