[nautilus] Fix usage of sink, fixing many recently introduced leaks.



commit 2434bd43cd43eb8ba97b1a956e4b3cd734cf2a91
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Sep 7 21:09:11 2009 +0200

    Fix usage of sink, fixing many recently introduced leaks.
    
    The conversion away from gtk_object_sink was done wrongly
    causing lots of leaks. fix this.

 eel/eel-background.c               |    3 ++-
 eel/eel-gtk-extensions.c           |    4 +++-
 libnautilus-private/nautilus-dnd.c |    4 +++-
 src/file-manager/fm-list-view.c    |    4 ++--
 src/file-manager/fm-tree-view.c    |    2 +-
 src/nautilus-emblem-sidebar.c      |    2 +-
 src/nautilus-history-sidebar.c     |    2 +-
 src/nautilus-information-panel.c   |    2 +-
 src/nautilus-notes-viewer.c        |    2 +-
 src/nautilus-places-sidebar.c      |    2 +-
 src/nautilus-spatial-window.c      |    1 +
 11 files changed, 17 insertions(+), 11 deletions(-)
---
diff --git a/eel/eel-background.c b/eel/eel-background.c
index 942e94c..9c40629 100644
--- a/eel/eel-background.c
+++ b/eel/eel-background.c
@@ -990,7 +990,7 @@ eel_get_widget_background (GtkWidget *widget)
 
 	/* Store the background in the widget's data. */
 	background = eel_background_new ();
-	g_object_ref (background);
+	g_object_ref_sink (background);
 	g_object_set_data_full (G_OBJECT (widget), "eel_background",
 				background, g_object_unref);
 	background->details->widget = widget;
@@ -1108,6 +1108,7 @@ eel_self_check_background (void)
 	eel_background_set_color (background, "red-blue:h");
 
 	g_object_ref_sink (background);
+	g_object_unref (background);
 }
 
 #endif
diff --git a/eel/eel-gtk-extensions.c b/eel/eel-gtk-extensions.c
index 87c5454..96453ee 100644
--- a/eel/eel-gtk-extensions.c
+++ b/eel/eel-gtk-extensions.c
@@ -395,6 +395,7 @@ eel_pop_up_context_menu (GtkMenu	     *menu,
 			event ? event->time : GDK_CURRENT_TIME); /* activate_time */
 
 	g_object_ref_sink (menu);
+	g_object_unref (menu);
 }
 
 GtkMenuItem *
@@ -1012,7 +1013,8 @@ eel_gtk_get_system_font (void)
 
 	font = pango_font_description_copy (label->style->font_desc);
 
- 	g_object_ref_sink (label);
+	g_object_ref_sink (label);
+	g_object_unref (label);
 
 	return font;
 }
diff --git a/libnautilus-private/nautilus-dnd.c b/libnautilus-private/nautilus-dnd.c
index c4d4f8d..b7e1df2 100644
--- a/libnautilus-private/nautilus-dnd.c
+++ b/libnautilus-private/nautilus-dnd.c
@@ -817,7 +817,8 @@ nautilus_drag_drop_action_ask (GtkWidget *widget,
 	
 	g_main_loop_unref (damd.loop);
 
-	g_object_ref_sink (menu);	
+	g_object_ref_sink (menu);
+	g_object_unref (menu);
 
 	return damd.chosen;
 }
@@ -871,6 +872,7 @@ nautilus_drag_drop_background_ask (GtkWidget *widget,
 	g_main_loop_unref (damd.loop);
 
 	g_object_ref_sink (menu);
+	g_object_unref (menu);
 
 	return damd.chosen;	
 }
diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c
index aec3963..2a1c8b8 100644
--- a/src/file-manager/fm-list-view.c
+++ b/src/file-manager/fm-list-view.c
@@ -1444,7 +1444,7 @@ create_and_set_up_tree_view (FMListView *view)
 			view->details->pixbuf_cell = (GtkCellRendererPixbuf *)cell;
 			
 			view->details->file_name_column = gtk_tree_view_column_new ();
-			g_object_ref (view->details->file_name_column);
+			g_object_ref_sink (view->details->file_name_column);
 			view->details->file_name_column_num = column_num;
 			
 			g_hash_table_insert (view->details->columns,
@@ -1482,7 +1482,7 @@ create_and_set_up_tree_view (FMListView *view)
 									   cell,
 									   "text", column_num,
 									   NULL);
-			g_object_ref (column);
+			g_object_ref_sink (column);
 			gtk_tree_view_column_set_sort_column_id (column, column_num);
 			g_hash_table_insert (view->details->columns, 
 					     g_strdup (name), 
diff --git a/src/file-manager/fm-tree-view.c b/src/file-manager/fm-tree-view.c
index 47e8cc0..1dff466 100644
--- a/src/file-manager/fm-tree-view.c
+++ b/src/file-manager/fm-tree-view.c
@@ -1705,7 +1705,7 @@ fm_tree_view_create (NautilusSidebarProvider *provider,
 	
 	sidebar = g_object_new (fm_tree_view_get_type (), NULL);
 	fm_tree_view_set_parent_window (sidebar, window);
-	g_object_ref (sidebar);
+	g_object_ref_sink (sidebar);
 
 	return NAUTILUS_SIDEBAR (sidebar);
 }
diff --git a/src/nautilus-emblem-sidebar.c b/src/nautilus-emblem-sidebar.c
index 6049351..3a5cb18 100644
--- a/src/nautilus-emblem-sidebar.c
+++ b/src/nautilus-emblem-sidebar.c
@@ -1076,7 +1076,7 @@ nautilus_emblem_sidebar_create (NautilusSidebarProvider *provider,
 	
 	sidebar = g_object_new (nautilus_emblem_sidebar_get_type (), NULL);
 	nautilus_emblem_sidebar_set_parent_window (sidebar, window);
-	g_object_ref (sidebar);
+	g_object_ref_sink (sidebar);
 
 	return NAUTILUS_SIDEBAR (sidebar);
 }
diff --git a/src/nautilus-history-sidebar.c b/src/nautilus-history-sidebar.c
index 444b9fe..17d72e8 100644
--- a/src/nautilus-history-sidebar.c
+++ b/src/nautilus-history-sidebar.c
@@ -383,7 +383,7 @@ nautilus_history_sidebar_create (NautilusSidebarProvider *provider,
 	
 	sidebar = g_object_new (nautilus_history_sidebar_get_type (), NULL);
 	nautilus_history_sidebar_set_parent_window (sidebar, window);
-	g_object_ref (sidebar);
+	g_object_ref_sink (sidebar);
 
 	return NAUTILUS_SIDEBAR (sidebar);
 }
diff --git a/src/nautilus-information-panel.c b/src/nautilus-information-panel.c
index 5050151..ce162ef 100644
--- a/src/nautilus-information-panel.c
+++ b/src/nautilus-information-panel.c
@@ -1171,7 +1171,7 @@ nautilus_information_panel_create (NautilusSidebarProvider *provider,
 	
 	panel = g_object_new (nautilus_information_panel_get_type (), NULL);
 	nautilus_information_panel_set_parent_window (panel, window);
-	g_object_ref (panel);
+	g_object_ref_sink (panel);
 
 	return NAUTILUS_SIDEBAR (panel);
 }
diff --git a/src/nautilus-notes-viewer.c b/src/nautilus-notes-viewer.c
index e71f393..6caafe1 100644
--- a/src/nautilus-notes-viewer.c
+++ b/src/nautilus-notes-viewer.c
@@ -448,7 +448,7 @@ nautilus_notes_viewer_create_sidebar (NautilusSidebarProvider *provider,
 	
 	sidebar = g_object_new (nautilus_notes_viewer_get_type (), NULL);
 	nautilus_notes_viewer_set_parent_window (sidebar, window);
-	g_object_ref (sidebar);
+	g_object_ref_sink (sidebar);
 
 	return NAUTILUS_SIDEBAR (sidebar);
 }
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c
index 144dab6..ce1c549 100644
--- a/src/nautilus-places-sidebar.c
+++ b/src/nautilus-places-sidebar.c
@@ -2687,7 +2687,7 @@ nautilus_places_sidebar_create (NautilusSidebarProvider *provider,
 	
 	sidebar = g_object_new (nautilus_places_sidebar_get_type (), NULL);
 	nautilus_places_sidebar_set_parent_window (sidebar, window);
-	g_object_ref (sidebar);
+	g_object_ref_sink (sidebar);
 
 	return NAUTILUS_SIDEBAR (sidebar);
 }
diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c
index 852d119..3e28954 100644
--- a/src/nautilus-spatial-window.c
+++ b/src/nautilus-spatial-window.c
@@ -744,6 +744,7 @@ location_button_clicked_callback (GtkWidget             *widget,
 	gtk_grab_remove (popup);
 	g_main_loop_unref (loop);
 	g_object_ref_sink (popup);
+	g_object_unref (popup);
 }
 
 static int



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