entry: Avoid criticals in dispose

The accessible gets properties of the entry, and
resetting the entry icons triggers accessible change
notification, so do that before we dismantle the entry
too far to respond to a g_object_get () call.
This commit is contained in:
Matthias Clasen 2020-02-04 22:15:32 +01:00
parent ed6c0dc15c
commit 005ea7a09d

View File

@ -1288,6 +1288,11 @@ gtk_entry_dispose (GObject *object)
GtkEntry *entry = GTK_ENTRY (object);
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
gtk_entry_set_icon_from_paintable (entry, GTK_ENTRY_ICON_PRIMARY, NULL);
gtk_entry_set_icon_tooltip_markup (entry, GTK_ENTRY_ICON_PRIMARY, NULL);
gtk_entry_set_icon_from_paintable (entry, GTK_ENTRY_ICON_SECONDARY, NULL);
gtk_entry_set_icon_tooltip_markup (entry, GTK_ENTRY_ICON_SECONDARY, NULL);
gtk_entry_set_completion (entry, NULL);
if (priv->text)
@ -1299,11 +1304,6 @@ gtk_entry_dispose (GObject *object)
g_clear_pointer (&priv->emoji_chooser, gtk_widget_unparent);
gtk_entry_set_icon_from_paintable (entry, GTK_ENTRY_ICON_PRIMARY, NULL);
gtk_entry_set_icon_tooltip_markup (entry, GTK_ENTRY_ICON_PRIMARY, NULL);
gtk_entry_set_icon_from_paintable (entry, GTK_ENTRY_ICON_SECONDARY, NULL);
gtk_entry_set_icon_tooltip_markup (entry, GTK_ENTRY_ICON_SECONDARY, NULL);
G_OBJECT_CLASS (gtk_entry_parent_class)->dispose (object);
}
@ -2299,18 +2299,19 @@ gtk_entry_set_icon_from_paintable (GtkEntry *entry,
GdkPaintable *paintable)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
g_return_if_fail (GTK_IS_ENTRY (entry));
g_return_if_fail (IS_VALID_ICON_POSITION (icon_pos));
if ((icon_info = priv->icons[icon_pos]) == NULL)
icon_info = construct_icon_info (GTK_WIDGET (entry), icon_pos);
g_object_freeze_notify (G_OBJECT (entry));
if (paintable)
{
EntryIconInfo *icon_info;
if ((icon_info = priv->icons[icon_pos]) == NULL)
icon_info = construct_icon_info (GTK_WIDGET (entry), icon_pos);
g_object_ref (paintable);
gtk_image_set_from_paintable (GTK_IMAGE (icon_info->widget), paintable);