[nautilus-actions] Fix segfault when unfiltering invalid items



commit ba2798e7dd5a2d91e2b9fc36afccbc67185daada
Author: Pierre Wieser <pwieser trychlos org>
Date:   Fri Jun 18 16:15:18 2010 +0200

    Fix segfault when unfiltering invalid items

 ChangeLog                         |    3 +++
 src/core/na-object.c              |   13 +++++++++----
 src/plugin-menu/nautilus-module.c |    4 ++++
 3 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e79e371..04e6d7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2010-06-18 Pierre Wieser <pwieser trychlos org>
 
+	* src/core/na-object.c (na_object_object_unref):
+	Fix segfault when unfiltering invalid items.
+
 	* src/core/na-object-item-factory.c:
 	Numeric version is no more writable by default.
 
diff --git a/src/core/na-object.c b/src/core/na-object.c
index ed3065b..e160a4b 100644
--- a/src/core/na-object.c
+++ b/src/core/na-object.c
@@ -710,7 +710,7 @@ na_object_object_ref( NAObject *object )
 void
 na_object_object_unref( NAObject *object )
 {
-	GList *children, *ic;
+	GList *children;
 
 	g_debug( "na_object_object_unref:enter: object=%p (%s, ref_count=%d)",
 			( void * ) object, G_OBJECT_TYPE_NAME( object ), G_OBJECT( object )->ref_count );
@@ -720,10 +720,15 @@ na_object_object_unref( NAObject *object )
 	if( !object->private->dispose_has_run ){
 
 		if( NA_IS_OBJECT_ITEM( object )){
-			children = na_object_get_items( object );
+			while( TRUE ){
+				children = na_object_get_items( object );
 
-			for( ic = children ; ic ; ic = ic->next ){
-				na_object_unref( ic->data );
+				if( children ){
+					na_object_unref( children->data );
+
+				} else {
+					break;
+				}
 			}
 		}
 
diff --git a/src/plugin-menu/nautilus-module.c b/src/plugin-menu/nautilus-module.c
index d9a3a46..810641a 100644
--- a/src/plugin-menu/nautilus-module.c
+++ b/src/plugin-menu/nautilus-module.c
@@ -34,6 +34,7 @@
 
 #include <string.h>
 #include <syslog.h>
+#include <unistd.h>
 
 #include <libnautilus-extension/nautilus-extension-types.h>
 
@@ -83,6 +84,9 @@ nautilus_module_list_types( const GType **types, int *num_types )
 	type_list[0] = NAUTILUS_ACTIONS_TYPE;
 	*types = type_list;
 	*num_types = 1;
+
+	/* this may let us some time to attach nautilus to the debugger :) */
+	/*sleep( 60 ); */
 }
 
 void



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