entry: make sure priv->current_pos is valid

We can e.g. get the entry dispose()d and a focus_out event after that
(because the toplevel unsets the focus which previously was the entry).
We then later use priv->current_pos in a call to pango API which makes
sure the given index is valid for the given layout. Since we lazily
create a GtkEntryBuffer in get_buffer() and a PangoLayout lazily in
gtk_entry_create_layout, these 2 are always valid but don't match
priv->current_pos in this situation.

Fix this by resetting priv->current-pos in dispose().

https://bugzilla.gnome.org/show_bug.cgi?id=785255
This commit is contained in:
Timm Bäder
2017-03-06 18:41:12 +01:00
committed by Daniel Boles
parent a30220d4e3
commit d9170e1978

View File

@ -2917,6 +2917,8 @@ gtk_entry_dispose (GObject *object)
gtk_entry_set_icon_tooltip_markup (entry, GTK_ENTRY_ICON_SECONDARY, NULL);
gtk_entry_set_completion (entry, NULL);
priv->current_pos = 0;
if (priv->buffer)
{
buffer_disconnect_signals (entry);