[goffice] GUI: work around trouble caused by a GTK+ leak.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] GUI: work around trouble caused by a GTK+ leak.
- Date: Wed, 22 Jun 2011 00:17:25 +0000 (UTC)
commit eb30c65bfb402c50cfa13428fe6e3400eb5eaf27
Author: Morten Welinder <terra gnome org>
Date: Tue Jun 21 20:15:47 2011 -0400
GUI: work around trouble caused by a GTK+ leak.
ChangeLog | 6 ++++++
NEWS | 1 +
goffice/graph/gog-graph.c | 15 +++++++++++++++
3 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 27cdf65..d87a503 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-06-21 Morten Welinder <terra gnome org>
+
+ * goffice/graph/gog-graph.c (gog_graph_populate_editor): Force the
+ GtkComboxBox to drop its model on destroy to prevent theme leak if
+ the combo is leaked itself. Fixes #652420.
+
2011-06-18 Morten Welinder <terra gnome org>
* goffice/gtk/go-marker-selector.c
diff --git a/NEWS b/NEWS
index 3bc4c0f..e5137ed 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ goffice 0.8.17:
Morten:
* Plug leaks.
+ * Fix noisy leak. [#652420]
--------------------------------------------------------------------------
goffice 0.8.16:
diff --git a/goffice/graph/gog-graph.c b/goffice/graph/gog-graph.c
index 5b55ed8..b707db3 100644
--- a/goffice/graph/gog-graph.c
+++ b/goffice/graph/gog-graph.c
@@ -200,6 +200,18 @@ cb_force_theme (GtkButton *button, GogGraph *graph)
}
static void
+unset_model (GtkComboBox *cb)
+{
+ /*
+ * We shouldn't have to do this, but with certain versions of GTK+ it
+ * appears we must. (Specifically because (1) most of GtkComboBox's
+ * finalizer should have been in the dispose method instead, and (2) it
+ * somehow leaks the GtkComboBox.
+ */
+ gtk_combo_box_set_model (cb, NULL);
+}
+
+static void
gog_graph_populate_editor (GogObject *gobj,
GOEditor *editor,
G_GNUC_UNUSED GogDataAllocator *dalloc,
@@ -232,6 +244,9 @@ gog_graph_populate_editor (GogObject *gobj,
combo = go_gtk_builder_get_widget (gui, "theme_combo");
model = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (combo)));
+ g_signal_connect (G_OBJECT (combo), "destroy",
+ G_CALLBACK (unset_model), NULL);
+
count = 0;
for (ptr = theme_names; ptr != NULL; ptr = ptr->next) {
theme = gog_theme_registry_lookup (ptr->data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]