gtkcellrenderertext: Sink floating entry before using as signal argument

Sink the GtkEntry assigned to the private structure of GtkCellRendererText
before signals containing it as an argument are sent out. This keeps
language bindings from sinking the reference and then destroying the entry
when the signal closure is finished.

https://bugzilla.gnome.org/show_bug.cgi?id=693400
This commit is contained in:
Simon Feltman 2013-02-07 23:03:52 -08:00
parent 154a144cf6
commit 283c974680

View File

@ -751,6 +751,8 @@ gtk_cell_renderer_text_finalize (GObject *object)
if (priv->language)
g_object_unref (priv->language);
g_clear_object (&priv->entry);
G_OBJECT_CLASS (gtk_cell_renderer_text_parent_class)->finalize (object);
}
@ -1915,7 +1917,7 @@ gtk_cell_renderer_text_editing_done (GtkCellEditable *entry,
priv = GTK_CELL_RENDERER_TEXT (data)->priv;
priv->entry = NULL;
g_clear_object (&priv->entry);
if (priv->focus_out_id > 0)
{
@ -2047,6 +2049,8 @@ gtk_cell_renderer_text_start_editing (GtkCellRenderer *cell,
gtk_cell_renderer_get_alignment (cell, &xalign, &yalign);
priv->entry = gtk_entry_new ();
g_object_ref_sink (G_OBJECT (priv->entry));
gtk_entry_set_has_frame (GTK_ENTRY (priv->entry), FALSE);
gtk_entry_set_alignment (GTK_ENTRY (priv->entry), xalign);