[glade3] * gladeui/glade-inspector.c: Fixed project leakage at dispose time.
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade3] * gladeui/glade-inspector.c: Fixed project leakage at dispose time.
- Date: Mon, 11 Oct 2010 12:08:56 +0000 (UTC)
commit 649c798eecd2e0d3c081ac70e4b62af14f205d9f
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Mon Oct 11 21:11:29 2010 +0900
* gladeui/glade-inspector.c: Fixed project leakage at dispose time.
ChangeLog | 4 ++++
gladeui/glade-inspector.c | 22 +++++++++++-----------
2 files changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 1734a7d..33fad2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-10-11 Tristan Van Berkom <tristanvb openismus com>
+
+ * gladeui/glade-inspector.c: Fixed project leakage at dispose time.
+
2010-10-09 Tristan Van Berkom <tristanvb openismus com>
* configure.ac: Default GTK+ version is 3.0, compiling --with-gtk=2.0 is
diff --git a/gladeui/glade-inspector.c b/gladeui/glade-inspector.c
index 57b722e..5daaec5 100644
--- a/gladeui/glade-inspector.c
+++ b/gladeui/glade-inspector.c
@@ -500,14 +500,9 @@ static void
glade_inspector_dispose (GObject *object)
{
GladeInspector *inspector = GLADE_INSPECTOR(object);
- GladeInspectorPrivate *priv = inspector->priv;
-
- if (priv->project)
- {
- g_object_unref (priv->project);
- priv->project = NULL;
- }
+ glade_inspector_set_project (inspector, NULL);
+
G_OBJECT_CLASS (glade_inspector_parent_class)->dispose (object);
}
@@ -790,23 +785,28 @@ glade_inspector_set_project (GladeInspector *inspector,
if (inspector->priv->project)
{
- disconnect_project_signals (inspector, project);
- g_object_unref (priv->project);
+ disconnect_project_signals (inspector, inspector->priv->project);
+
+ /* Release our filter which releases the project */
+ gtk_tree_view_set_model (GTK_TREE_VIEW (priv->view), NULL);
+ priv->filter = NULL;
priv->project = NULL;
}
if (project)
{
priv->project = project;
- g_object_ref (priv->project);
- priv->filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (priv->project), NULL);
+ /* The filter holds our reference to 'project' */
+ priv->filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (priv->project), NULL);
gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (priv->filter),
(GtkTreeModelFilterVisibleFunc)glade_inspector_visible_func,
inspector, NULL);
gtk_tree_view_set_model (GTK_TREE_VIEW (priv->view), priv->filter);
+ g_object_unref (priv->filter); /* pass ownership of the filter to the model */
+
connect_project_signals (inspector, project);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]