[gtk+] entry: make sure priv->current_pos is valid
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] entry: make sure priv->current_pos is valid
- Date: Mon, 13 Mar 2017 14:39:12 +0000 (UTC)
commit 9047a5dc52fa31dec2dc8adcb73128ed82333385
Author: Timm Bäder <mail baedert org>
Date: Mon Mar 6 18:41:12 2017 +0100
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().
gtk/gtkentry.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 261e97f..dded3b8 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -2664,6 +2664,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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]