[nautilus-actions] NAObjectItem: improve debug messages



commit ae6d44be792a8cbb4dd2134cd7b9f650f3a7a1be
Author: Pierre Wieser <pwieser trychlos org>
Date:   Tue Feb 14 06:45:24 2012 +0100

    NAObjectItem: improve debug messages

 ChangeLog                 |    6 ++++++
 src/core/na-object-item.c |   21 +++++++++++++++++----
 2 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bada58f..72b39f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-02-14 Pierre Wieser <pwieser trychlos org>
+
+	* src/core/na-object-item.c
+	(na_object_item_copyref_items, na_object_item_free_items):
+	Improve debug messages.
+
 2012-02-08 Pierre Wieser <pwieser trychlos org>
 
 	* src/nact/nact-menubar-file.c (nact_menubar_file_on_new_profile):
diff --git a/src/core/na-object-item.c b/src/core/na-object-item.c
index ced7cc7..db0403c 100644
--- a/src/core/na-object-item.c
+++ b/src/core/na-object-item.c
@@ -719,8 +719,16 @@ count_items_rec( GList *items, gint *menus, gint *actions, gint *profiles, gbool
 GList *
 na_object_item_copyref_items( GList *items )
 {
-	GList *copy = g_list_copy( items );
-	g_list_foreach( copy, ( GFunc ) na_object_object_ref, NULL );
+	GList *copy = NULL;
+
+	if( items ){
+		copy = g_list_copy( items );
+		g_list_foreach( copy, ( GFunc ) na_object_object_ref, NULL );
+		g_debug( "na_object_item_copyref_items: list at %p contains %s at %p (ref_count=%d)",
+				( void * ) copy,
+				G_OBJECT_TYPE_NAME( copy->data ), ( void * ) copy->data, G_OBJECT( copy->data )->ref_count );
+	}
+
 	return( copy );
 }
 
@@ -737,8 +745,13 @@ na_object_item_copyref_items( GList *items )
 GList *
 na_object_item_free_items( GList *items )
 {
-	g_list_foreach( items, ( GFunc ) na_object_object_unref, NULL );
-	g_list_free( items );
+	if( items ){
+		g_debug( "na_object_item_free_items: freeing list at %p which contains %s at %p (ref_count=%d)",
+				( void * ) items,
+				G_OBJECT_TYPE_NAME( items->data ), ( void * ) items->data, G_OBJECT( items->data )->ref_count );
+		g_list_foreach( items, ( GFunc ) na_object_object_unref, NULL );
+		g_list_free( items );
+	}
 	return( NULL );
 }
 



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