[PATCH] Fix for #120222 (Crash on duplicate mounts)



This patch prevents Nautilus from crashing when a filesystem is mounted
multiple times with the same name and is listed in /etc/fstab (#120222).

Cheers,
Martin
Index: libnautilus-private/nautilus-directory.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-directory.c,v
retrieving revision 1.249
diff -p -u -r1.249 nautilus-directory.c
--- libnautilus-private/nautilus-directory.c	29 Aug 2003 12:03:52 -0000	1.249
+++ libnautilus-private/nautilus-directory.c	1 Dec 2003 22:48:55 -0000
@@ -542,8 +542,16 @@ static void
 add_to_hash_table (NautilusDirectory *directory, NautilusFile *file, GList *node)
 {
 	g_assert (node != NULL);
-	g_assert (g_hash_table_lookup (directory->details->file_hash,
-				       file->details->relative_uri) == NULL);
+	
+	/* Don't add the same file twice. 
+	 * An attempt to do so occurs when we're in the desktop directory
+	 * and a filesystem is mounted multiple times.
+	 */
+	if (g_hash_table_lookup (directory->details->file_hash,
+				 file->details->relative_uri) != NULL) {
+		return;
+	}
+
 	g_hash_table_insert (directory->details->file_hash,
 			     file->details->relative_uri, node);
 }


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