[goffice] GUI: Plug leaks.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] GUI: Plug leaks.
- Date: Wed, 23 Feb 2011 18:36:42 +0000 (UTC)
commit 1df7e247b61115078c9d6e476d6dbb4746d48e6a
Author: Morten Welinder <terra gnome org>
Date: Wed Feb 23 13:36:29 2011 -0500
GUI: Plug leaks.
ChangeLog | 12 ++++++++++++
goffice/graph/gog-axis-line.c | 1 +
goffice/graph/gog-guru.c | 6 ++++--
goffice/graph/gog-plot.c | 1 +
goffice/gtk/go-charmap-sel.c | 16 +++++++---------
goffice/gtk/go-locale-sel.c | 2 --
plugins/plot_distrib/go-distribution-prefs.c | 1 +
7 files changed, 26 insertions(+), 13 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f9e0a53..ad3babb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-02-23 Morten Welinder <terra gnome org>
+
+ * goffice/gtk/go-charmap-sel.c (cs_build_menu): Plug leak.
+
+ * goffice/graph/gog-guru.c (graph_guru_init_format_page): Plug
+ leak.
+ (graph_guru_type_selector_new): Ditto.
+ * goffice/graph/gog-axis-line.c (gog_axis_base_populate_editor):
+ Ditto.
+ * plugins/plot_distrib/go-distribution-prefs.c (go_distribution_pref_new):
+ Ditto.
+
2011-02-22 Morten Welinder <terra gnome org>
* goffice/gtk/go-locale-sel.c (ls_build_menu): Plug leak.
diff --git a/goffice/graph/gog-axis-line.c b/goffice/graph/gog-axis-line.c
index a6892fc..da30abc 100644
--- a/goffice/graph/gog-axis-line.c
+++ b/goffice/graph/gog-axis-line.c
@@ -527,6 +527,7 @@ gog_axis_base_populate_editor (GogObject *gobj,
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_UINT);
combo = go_gtk_builder_get_widget (gui, "cross_axis_combo");
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (store));
+ g_object_unref (store);
cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE);
diff --git a/goffice/graph/gog-guru.c b/goffice/graph/gog-guru.c
index 1097daf..75bcfa3 100644
--- a/goffice/graph/gog-guru.c
+++ b/goffice/graph/gog-guru.c
@@ -988,8 +988,9 @@ graph_guru_init_format_page (GraphGuruState *s)
s->prop_container = GTK_CONTAINER (w);
s->prop_model = gtk_tree_store_new (PLOT_ATTR_NUM_COLUMNS,
G_TYPE_STRING, G_TYPE_POINTER);
- s->prop_view = GTK_TREE_VIEW (gtk_tree_view_new_with_model (
- GTK_TREE_MODEL (s->prop_model)));
+ s->prop_view = GTK_TREE_VIEW (gtk_tree_view_new_with_model
+ (GTK_TREE_MODEL (s->prop_model)));
+ g_object_unref (s->prop_model);
s->prop_selection = gtk_tree_view_get_selection (s->prop_view);
gtk_tree_selection_set_mode (s->prop_selection, GTK_SELECTION_BROWSE);
g_signal_connect_swapped (s->prop_selection,
@@ -1172,6 +1173,7 @@ graph_guru_type_selector_new (GraphGuruState *s)
typesel->list_view = GTK_TREE_VIEW (gtk_builder_get_object (gui, "type_treeview"));
gtk_tree_view_set_model (typesel->list_view, GTK_TREE_MODEL (typesel->model));
+ g_object_unref (typesel->model);
gtk_tree_view_append_column (typesel->list_view,
gtk_tree_view_column_new_with_attributes ("",
gtk_cell_renderer_pixbuf_new (),
diff --git a/goffice/graph/gog-plot.c b/goffice/graph/gog-plot.c
index 546b022..01bd213 100644
--- a/goffice/graph/gog-plot.c
+++ b/goffice/graph/gog-plot.c
@@ -208,6 +208,7 @@ gog_plot_populate_editor (GogObject *obj,
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_UINT);
combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store));
+ g_object_unref (store);
cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE);
diff --git a/goffice/gtk/go-charmap-sel.c b/goffice/gtk/go-charmap-sel.c
index 986f81e..287133b 100644
--- a/goffice/gtk/go-charmap-sel.c
+++ b/goffice/gtk/go-charmap-sel.c
@@ -363,12 +363,8 @@ cs_build_menu (GOCharmapSel *cs)
while (lgroup->group_name) {
CharsetInfo const *charset_trans;
- GtkMenu *submenu;
- gint cnt = 0;
+ GtkMenu *submenu = NULL;
- item = gtk_menu_item_new_with_label (_(lgroup->group_name));
-
- submenu = GTK_MENU (gtk_menu_new ());
charset_trans = charset_trans_array;
while (charset_trans->lgroup != LG_LAST) {
@@ -378,6 +374,8 @@ cs_build_menu (GOCharmapSel *cs)
? charset_trans->to_utf8_iconv_name
: charset_trans->from_utf8_iconv_name;
if (name) {
+ if (!submenu)
+ submenu = GTK_MENU (gtk_menu_new ());
subitem = gtk_check_menu_item_new_with_label
(_(charset_trans->charset_title));
gtk_check_menu_item_set_draw_as_radio (GTK_CHECK_MENU_ITEM (subitem), TRUE);
@@ -387,20 +385,20 @@ cs_build_menu (GOCharmapSel *cs)
cs_emphasize_label (GTK_LABEL (gtk_bin_get_child (GTK_BIN (subitem))));
g_object_set_data (G_OBJECT (subitem), CHARMAP_NAME_KEY,
(gpointer)name);
- cnt++;
} else if (0) {
g_print ("Unsupported: %s\n", charset_trans->aliases);
}
}
charset_trans++;
}
- if (cnt > 0) {
+ if (submenu) {
+ GtkWidget *item =
+ gtk_menu_item_new_with_label (_(lgroup->group_name));
+
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), GTK_WIDGET (submenu));
gtk_widget_show (item);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
lg_cnt++;
- } else {
- g_object_unref (item);
}
lgroup++;
}
diff --git a/goffice/gtk/go-locale-sel.c b/goffice/gtk/go-locale-sel.c
index f989a49..d74c53c 100644
--- a/goffice/gtk/go-locale-sel.c
+++ b/goffice/gtk/go-locale-sel.c
@@ -426,7 +426,6 @@ ls_build_menu (GOLocaleSel *ls)
while (lgroup->group_name) {
LocaleInfo const *locale_trans;
GtkMenu *submenu = NULL;
- gint cnt = 0;
locale_trans = locale_trans_array;
@@ -443,7 +442,6 @@ ls_build_menu (GOLocaleSel *ls)
gtk_menu_shell_append (GTK_MENU_SHELL (submenu), subitem);
g_object_set_data (G_OBJECT (subitem), LOCALE_NAME_KEY,
(locale_trans->actual_locale));
- cnt++;
}
locale_trans++;
}
diff --git a/plugins/plot_distrib/go-distribution-prefs.c b/plugins/plot_distrib/go-distribution-prefs.c
index 9792de2..9074c10 100644
--- a/plugins/plot_distrib/go-distribution-prefs.c
+++ b/plugins/plot_distrib/go-distribution-prefs.c
@@ -117,6 +117,7 @@ go_distribution_pref_new (GObject *obj, GogDataAllocator *dalloc, G_GNUC_UNUSED
/* add the list of known distributions in a combobox */
model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
w = gtk_combo_box_new_with_model (GTK_TREE_MODEL (model));
+ g_object_unref (model);
renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (w), renderer, FALSE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (w), renderer,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]