[PATCH] Crash renaming empty selection (#131861)



Hi,

another patch: When you start to rename a file and then rapidly unselect
it by clicking elsewhere, Nautilus derefs a null pointer.

Martin

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.6077
diff -u -p -r1.6077 ChangeLog
--- ChangeLog	5 Feb 2004 16:23:40 -0000	1.6077
+++ ChangeLog	5 Feb 2004 23:04:25 -0000
@@ -1,3 +1,8 @@
+2004-02-05  Martin Wehner  <martin wehner epost de>
+
+	* src/file-manager/fm-directory-view.c (rename_file_callback):
+	Don't crash when trying to rename empty selection. Fixes bug #131861.
+
 2004-02-05  Padraig O'Briain  <padraig obriain sun com>
 
 	* libnautilus-private/ nautilus-file-operations.c (confirm_empty_trash):
Index: src/file-manager/fm-directory-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-directory-view.c,v
retrieving revision 1.606
diff -u -p -r1.606 fm-directory-view.c
--- src/file-manager/fm-directory-view.c	28 Jan 2004 06:04:49 -0000	1.606
+++ src/file-manager/fm-directory-view.c	5 Feb 2004 23:04:27 -0000
@@ -4811,11 +4811,11 @@ rename_file_callback (BonoboUIComponent 
 	view = FM_DIRECTORY_VIEW (callback_data);
 	selection = fm_directory_view_get_selection (view);
 
-	file = NAUTILUS_FILE (selection->data);
-
-	EEL_CALL_METHOD (FM_DIRECTORY_VIEW_CLASS, view, start_renaming_file, (view, file));
-	
-	nautilus_file_list_free (selection);
+	if (selection_not_empty_in_menu_callback (view, selection)) {
+		file = NAUTILUS_FILE (selection->data);
+		EEL_CALL_METHOD (FM_DIRECTORY_VIEW_CLASS, view, start_renaming_file, (view, file));
+		nautilus_file_list_free (selection);
+	}
 }
 
 static void


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