diff options
author | Matthias Clasen <maclas@gmx.de> | 2004-02-05 23:45:21 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2004-02-05 23:45:21 +0000 |
commit | 3b15c8b23229580b13e638720c9a9fe1eda5b1eb (patch) | |
tree | b84688217c2f8d421668d388fe14be7fa0fde1d2 /gtk | |
parent | 5cc85a5a63ff87982ebb7625eec386c966d7cc63 (diff) | |
download | gtk+-3b15c8b23229580b13e638720c9a9fe1eda5b1eb.tar.gz |
Add a finalize function to plug a few memory leaks. (#133544, Morten
Fri Feb 6 00:45:16 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcombobox.c (gtk_combo_box_finalize): Add a finalize
function to plug a few memory leaks. (#133544, Morten Welinder)
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkcombobox.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index c666578e8e..2534ac84ed 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -136,6 +136,7 @@ static void gtk_combo_box_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *spec); +static void gtk_combo_box_finalize (GObject *object); static void gtk_combo_box_style_set (GtkWidget *widget, GtkStyle *previous_style, @@ -322,6 +323,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) widget_class->mnemonic_activate = gtk_combo_box_mnemonic_activate; object_class = (GObjectClass *)klass; + object_class->finalize = gtk_combo_box_finalize; object_class->set_property = gtk_combo_box_set_property; object_class->get_property = gtk_combo_box_get_property; @@ -2376,7 +2378,7 @@ gtk_combo_box_cell_layout_reorder (GtkCellLayout *layout, GtkWidget * gtk_combo_box_new (void) { - return GTK_WIDGET (g_object_new (gtk_combo_box_get_type (), NULL)); + return GTK_WIDGET (g_object_new (GTK_TYPE_COMBO_BOX, NULL)); } /** @@ -2396,7 +2398,7 @@ gtk_combo_box_new_with_model (GtkTreeModel *model) g_return_val_if_fail (GTK_IS_TREE_MODEL (model), NULL); - combo_box = GTK_COMBO_BOX (g_object_new (gtk_combo_box_get_type (), + combo_box = GTK_COMBO_BOX (g_object_new (GTK_TYPE_COMBO_BOX, "model", model, NULL)); @@ -2839,3 +2841,26 @@ gtk_combo_box_mnemonic_activate (GtkWidget *widget, return TRUE; } + +static void +gtk_combo_box_finalize (GObject *object) +{ + GtkComboBox *combo_box = GTK_COMBO_BOX (object); + + if (GTK_IS_MENU (combo_box->priv->popup_widget)) + gtk_combo_box_menu_destroy (combo_box); + + if (GTK_IS_TREE_VIEW (combo_box->priv->tree_view)) + gtk_combo_box_list_destroy (combo_box); + + if (combo_box->priv->popup_window) + gtk_widget_destroy (combo_box->priv->popup_window); + + if (combo_box->priv->model) + g_object_unref (combo_box->priv->model); + + g_slist_foreach (combo_box->priv->cells, (GFunc)g_free, NULL); + g_slist_free (combo_box->priv->cells); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} |