[PATCH] Fix file properties dialog monitor addition/removal, properly disconnect on destroy



It's quiet dumb to register a file monitor with a pointer that isn't
guaranteed to be constant among the lifecycle of the properties dialog -
or am I missing something? Also, if a file isn't deleted while the
properties dialog is alife, the "changed" callback is not	 disconnected
until the file is destroyed.

-- 
Christian Neumair <chris gnome-de org>
Index: src/file-manager/fm-properties-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-properties-window.c,v
retrieving revision 1.219
diff -u -p -r1.219 fm-properties-window.c
--- src/file-manager/fm-properties-window.c	20 Sep 2005 16:05:44 -0000	1.219
+++ src/file-manager/fm-properties-window.c	3 Oct 2005 16:20:44 -0000
@@ -3356,8 +3326,7 @@ create_properties_window (StartupData *s
 		attributes |= NAUTILUS_FILE_ATTRIBUTE_DISPLAY_NAME
 			| NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE;
 
-		nautilus_file_monitor_add (NAUTILUS_FILE (l->data),
-					   &window->details->original_files, 
+		nautilus_file_monitor_add (NAUTILUS_FILE (l->data), window,
 					   attributes);	
 	}
 	
@@ -3373,7 +3342,7 @@ create_properties_window (StartupData *s
 		}
 		
 		attributes |= NAUTILUS_FILE_ATTRIBUTE_METADATA;
-		nautilus_file_monitor_add (file, &window->details->target_files, attributes);
+		nautilus_file_monitor_add (file, window, attributes);
 	}	
 		
 	for (l = window->details->target_files; l != NULL; l = l->next) {
@@ -3679,13 +3648,21 @@ real_destroy (GtkObject *object)
 	remove_window (window);
 
 	for (l = window->details->original_files; l != NULL; l = l->next) {
-		nautilus_file_monitor_remove (NAUTILUS_FILE (l->data), &window->details->original_files);
+		nautilus_file_monitor_remove (NAUTILUS_FILE (l->data), window);
+
+		g_signal_handlers_disconnect_by_func (l->data,
+						      G_CALLBACK (file_changed_callback),
+						      window);
 	}
 	nautilus_file_list_free (window->details->original_files);
 	window->details->original_files = NULL;
 	
 	for (l = window->details->target_files; l != NULL; l = l->next) {
-		nautilus_file_monitor_remove (NAUTILUS_FILE (l->data), &window->details->target_files);
+		nautilus_file_monitor_remove (NAUTILUS_FILE (l->data), window);
+
+		g_signal_handlers_disconnect_by_func (l->data,
+						      G_CALLBACK (file_changed_callback),
+						      window);
 	}
 	nautilus_file_list_free (window->details->target_files);
 	window->details->target_files = NULL;

Attachment: signature.asc
Description: This is a digitally signed message part



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