[nautilus-actions] NactMenubar: no more keep a recursive ref on the selection



commit d81b2ed1ab0bfdfff565154fb5da3607c25a18ec
Author: Pierre Wieser <pwieser trychlos org>
Date:   Tue Feb 14 07:02:37 2012 +0100

    NactMenubar: no more keep a recursive ref on the selection

 ChangeLog               |   12 ++++++++++++
 src/nact/nact-menubar.c |    6 +++---
 2 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 1326888..0941517 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2012-02-14 Pierre Wieser <pwieser trychlos org>
 
+	* src/nact/nact-menubar.c (instance_dispose,
+	on_tree_view_selection_changed): Keeping a recursive ref on the current
+	selection is definitively a bad idea;; only keep a copy of the list.
+
+	The bad idea is actually:
+	- keep a recursive ref on the current selection,
+	- does someting in the UI, e.g. insert a new item in the selection,
+	- then select the newly inserted item,
+	  > thus recursively unreffing the kept previous selection
+	  > so unreffing the inserted item which unfortunately was not previously
+	    counted -> so ref_count miss.
+
 	* src/nact/nact-menubar-maintainer.c
 	(nact_menubar_maintainer_on_dump_selection): Incrementing the objects
 	ref_count on dump is useless.
diff --git a/src/nact/nact-menubar.c b/src/nact/nact-menubar.c
index c4f9fb1..5e2b68a 100644
--- a/src/nact/nact-menubar.c
+++ b/src/nact/nact-menubar.c
@@ -358,7 +358,7 @@ instance_dispose( GObject *object )
 		g_object_unref( self->private->sort_buttons );
 
 		if( self->private->selected_items ){
-			self->private->selected_items = na_object_free_items( self->private->selected_items );
+			g_list_free( self->private->selected_items );
 		}
 
 		/* chain up to the parent class */
@@ -782,9 +782,9 @@ on_tree_view_selection_changed( BaseWindow *window, GList *selected, gpointer us
 	/* take a ref of the list of selected items
 	 */
 	if( bar->private->selected_items ){
-		bar->private->selected_items = na_object_free_items( bar->private->selected_items );
+		g_list_free( bar->private->selected_items );
 	}
-	bar->private->selected_items = na_object_copyref_items( selected );
+	bar->private->selected_items = g_list_copy( selected );
 
 	/* check if the parent of the first selected item is writable
 	 * (File: New menu/New action)



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