Nautilus freeze break request



Hi everyone,

I have a patch that plugs another memory leak in Nautilus. This is
basically a regression, we used to call nautilus_icon_view_clear()
already in previous versions, and this got removed during refactoring.

Patch is attached. Thanks,

Cosimo
>From 4e75a3b805b007c863ad2eb4b3be62a97249c33d Mon Sep 17 00:00:00 2001
From: Cosimo Cecchi <cosimoc gnome org>
Date: Fri, 25 Mar 2011 15:26:14 -0400
Subject: [PATCH] icon-view: clear the icon view when destroying it

This ensures all NautilusFiles are properly unreffed when destroying the
view, and fixes a leak.
---
 src/nautilus-icon-view.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/nautilus-icon-view.c b/src/nautilus-icon-view.c
index dc6ce22..68ba2cc 100644
--- a/src/nautilus-icon-view.c
+++ b/src/nautilus-icon-view.c
@@ -198,6 +198,7 @@ static void                 preview_audio                             (NautilusI
 static void                 update_layout_menus                       (NautilusIconView     *view);
 static NautilusFileSortType get_default_sort_order                    (NautilusFile         *file,
 								       gboolean             *reversed);
+static void                 nautilus_icon_view_clear                  (NautilusView         *view);
 
 G_DEFINE_TYPE (NautilusIconView, nautilus_icon_view, NAUTILUS_TYPE_VIEW);
 
@@ -208,6 +209,8 @@ nautilus_icon_view_destroy (GtkWidget *object)
 
 	icon_view = NAUTILUS_ICON_VIEW (object);
 
+	nautilus_icon_view_clear (NAUTILUS_VIEW (object));
+
         if (icon_view->details->react_to_icon_change_idle_id != 0) {
                 g_source_remove (icon_view->details->react_to_icon_change_idle_id);
 		icon_view->details->react_to_icon_change_idle_id = 0;
@@ -2544,6 +2547,8 @@ create_icon_container (NautilusIconView *icon_view)
 
 	icon_container = nautilus_icon_view_container_new (icon_view);
 	icon_view->details->icon_container = GTK_WIDGET (icon_container);
+	g_object_add_weak_pointer (G_OBJECT (icon_container),
+				   (gpointer *) &icon_view->details->icon_container);
 	
 	gtk_widget_set_can_focus (GTK_WIDGET (icon_container), TRUE);
 	
-- 
1.7.4.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]