[nautilus] Fix crash when middle click on an invalid network share in Places



commit 263051df98aace0b59fb2bd1772711dceba8e404
Author: Marcus Carlson <marcus mejlamej nu>
Date:   Wed Apr 7 09:55:49 2010 +0200

    Fix crash when middle click on an invalid network share in Places
    
    https://bugzilla.gnome.org/show_bug.cgi?id=579627

 src/nautilus-window-manage-views.c |   31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 deletions(-)
---
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index ac3d6bc..b57b973 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -1172,20 +1172,25 @@ got_file_info_for_view_selection_callback (NautilusFile *file,
 			 *   cancel_viewed_file_changed_callback (slot);
 			 * at this point, or in end_location_change()
 			 */
-
-			/* We disconnected this, so we need to re-connect it */
-			viewed_file = nautilus_file_get (slot->location);
-			nautilus_window_slot_set_viewed_file (slot, viewed_file);
-			nautilus_file_monitor_add (viewed_file, &slot->viewed_file, 0);
-			g_signal_connect_object (viewed_file, "changed",
-						 G_CALLBACK (viewed_file_changed_callback), slot, 0);
-			nautilus_file_unref (viewed_file);
+			/* We're missing a previous location (if opened location
+			 * in a new tab) so close it and return */
+			if (slot->location == NULL) {
+				nautilus_window_slot_close (slot);
+			} else {
+				/* We disconnected this, so we need to re-connect it */
+				viewed_file = nautilus_file_get (slot->location);
+				nautilus_window_slot_set_viewed_file (slot, viewed_file);
+				nautilus_file_monitor_add (viewed_file, &slot->viewed_file, 0);
+				g_signal_connect_object (viewed_file, "changed",
+							 G_CALLBACK (viewed_file_changed_callback), slot, 0);
+				nautilus_file_unref (viewed_file);
 			
-			/* Leave the location bar showing the bad location that the user
-			 * typed (or maybe achieved by dragging or something). Many times
-			 * the mistake will just be an easily-correctable typo. The user
-			 * can choose "Refresh" to get the original URI back in the location bar.
-			 */
+				/* Leave the location bar showing the bad location that the user
+				 * typed (or maybe achieved by dragging or something). Many times
+				 * the mistake will just be an easily-correctable typo. The user
+				 * can choose "Refresh" to get the original URI back in the location bar.
+				 */
+			}
 		}
 	}
 	



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