diff options
author | Matthias Clasen <maclas@gmx.de> | 2004-02-26 20:51:02 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2004-02-26 20:51:02 +0000 |
commit | 2b7b833e045bbaa7c7710257a4349ca93cb1eba0 (patch) | |
tree | d0a46dcb9d775475659b6967e418d1bb281932fa /gtk/gtkcombobox.c | |
parent | af02a5ccd3fe8794087bdaa7acec421342f7aaab (diff) | |
download | gtk+-2b7b833e045bbaa7c7710257a4349ca93cb1eba0.tar.gz |
Fixes for #12804 and #134722, Damon Chaplin:
Thu Feb 26 21:52:58 2004 Matthias Clasen <maclas@gmx.de>
Fixes for #12804 and #134722, Damon Chaplin:
* gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_end):
* gtk/gtkcombobox.c (gtk_combo_box_cell_layout_pack_start):
Ref and sink the cell renderers here.
* gtk/gtkcombobox.c (gtk_combo_box_finalize): Unref the cell
renderers here, and free attributes and func_data.
Diffstat (limited to 'gtk/gtkcombobox.c')
-rw-r--r-- | gtk/gtkcombobox.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 357e5f6954..1ae57c59b7 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -2138,6 +2138,9 @@ gtk_combo_box_cell_layout_pack_start (GtkCellLayout *layout, combo_box = GTK_COMBO_BOX (layout); + g_object_ref (G_OBJECT (cell)); + gtk_object_sink (GTK_OBJECT (cell)); + info = g_new0 (ComboCellInfo, 1); info->cell = cell; info->expand = expand; @@ -2187,6 +2190,9 @@ gtk_combo_box_cell_layout_pack_end (GtkCellLayout *layout, combo_box = GTK_COMBO_BOX (layout); + g_object_ref (G_OBJECT (cell)); + gtk_object_sink (GTK_OBJECT (cell)); + info = g_new0 (ComboCellInfo, 1); info->cell = cell; info->expand = expand; @@ -3005,6 +3011,7 @@ static void gtk_combo_box_finalize (GObject *object) { GtkComboBox *combo_box = GTK_COMBO_BOX (object); + GSList *i; gtk_combo_box_unset_model (combo_box); @@ -3020,7 +3027,24 @@ gtk_combo_box_finalize (GObject *object) if (combo_box->priv->model) g_object_unref (combo_box->priv->model); - g_slist_foreach (combo_box->priv->cells, (GFunc)g_free, NULL); + for (i = combo_box->priv->cells; i; i = i->next) + { + ComboCellInfo *info = (ComboCellInfo *)i->data; + GSList *list = info->attributes; + + if (info->destroy) + info->destroy (info->func_data); + + while (list && list->next) + { + g_free (list->data); + list = list->next->next; + } + g_slist_free (info->attributes); + + g_object_unref (G_OBJECT (info->cell)); + g_free (info); + } g_slist_free (combo_box->priv->cells); G_OBJECT_CLASS (parent_class)->finalize (object); |