[nautilus/gnome-3-6] slot: use the pending location when creating a query editor in loading



commit bba36c99a58c61a61b9af3d3832ca25c7635103b
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Oct 2 15:46:14 2012 -0400

    slot: use the pending location when creating a query editor in loading
    
    Or we'll segfault calling nautilus_directory_get() on a NULL location.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685293

 src/nautilus-window-slot.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index aaa567a..87bc777 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -190,8 +190,21 @@ update_query_editor (NautilusWindowSlot *slot)
 {
 	NautilusDirectory *directory;
 	NautilusSearchDirectory *search_directory;
+	GFile *location;
 
-	directory = nautilus_directory_get (slot->location);
+	/* This might be called while we're still loading the location.
+	 * In such a case, just set slot->load_with_search to TRUE, to stop
+	 * nautilus_window_sync_search_widgets() from hiding it again when
+	 * loading has completed.
+	 */
+	if (slot->location) {
+		location = slot->location;
+	} else {
+		location = slot->pending_location;
+		slot->load_with_search = TRUE;
+	}
+
+	directory = nautilus_directory_get (location);
 
 	if (NAUTILUS_IS_SEARCH_DIRECTORY (directory)) {
 		NautilusQuery *query;
@@ -203,7 +216,7 @@ update_query_editor (NautilusWindowSlot *slot)
 			g_object_unref (query);
 		}
 	} else {
-		nautilus_query_editor_set_location (slot->query_editor, slot->location);
+		nautilus_query_editor_set_location (slot->query_editor, location);
 	}
 
 	nautilus_directory_unref (directory);



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