reset the completion prefix on Enter too, plug potential leak. Follow-up

2007-07-31  Xan Lopez  <xan@gnome.org>

	* gtk/gtkentry.c (gtk_entry_completion_key_press): reset the
	completion prefix on Enter too, plug potential leak.
	Follow-up to #458298

svn path=/trunk/; revision=18559
This commit is contained in:
Xan Lopez 2007-07-31 19:17:25 +00:00 committed by Xan Lopez
parent b11262594c
commit f581dcca39
2 changed files with 25 additions and 12 deletions

View File

@ -1,3 +1,9 @@
2007-07-31 Xan Lopez <xan@gnome.org>
* gtk/gtkentry.c (gtk_entry_completion_key_press): reset the
completion prefix on Enter too, plug potential leak.
Follow-up to #458298
2007-07-31 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktooltip.c (gtk_tooltip_init): Make the label

View File

@ -5896,15 +5896,18 @@ gtk_entry_completion_key_press (GtkWidget *widget,
GtkTreeSelection *sel;
GtkTreeIter iter;
GtkTreeModel *model = NULL;
gboolean retval = TRUE;
_gtk_entry_reset_im_context (GTK_ENTRY (widget));
_gtk_entry_completion_popdown (completion);
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->tree_view));
if (!gtk_tree_selection_get_selected (sel, &model, &iter))
return FALSE;
if (completion->priv->inline_selection)
{
retval = FALSE;
goto keypress_completion_out;
}
else if (completion->priv->inline_selection)
{
/* Escape rejects the tentative completion */
if (event->keyval == GDK_Escape)
@ -5924,12 +5927,16 @@ gtk_entry_completion_key_press (GtkWidget *widget,
gtk_editable_set_position (GTK_EDITABLE (widget), -1);
else
gtk_editable_set_position (GTK_EDITABLE (widget), 0);
}
keypress_completion_out:
if (completion->priv->inline_selection)
{
g_free (completion->priv->completion_prefix);
completion->priv->completion_prefix = NULL;
}
return TRUE;
return retval;
}
else if (event->keyval == GDK_Tab ||
event->keyval == GDK_KP_Tab ||
@ -5941,11 +5948,8 @@ gtk_entry_completion_key_press (GtkWidget *widget,
_gtk_entry_reset_im_context (GTK_ENTRY (widget));
_gtk_entry_completion_popdown (completion);
if (completion->priv->completion_prefix)
{
g_free (completion->priv->completion_prefix);
completion->priv->completion_prefix = NULL;
}
gtk_widget_child_focus (gtk_widget_get_toplevel (widget), dir);
@ -5990,6 +5994,9 @@ gtk_entry_completion_key_press (GtkWidget *widget,
g_free (str);
}
g_free (completion->priv->completion_prefix);
completion->priv->completion_prefix = NULL;
return TRUE;
}
else if (completion->priv->current_selected - matches >= 0)