[nautilus/gnome-3-2] places-sidebar: don't crash when middle clicking on empty space



commit aa26a4d70d463e4f4e1a1d7ae0252e51d8f5e4a2
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Oct 17 11:18:43 2011 -0400

    places-sidebar: don't crash when middle clicking on empty space
    
    gtk_tree_view_get_path_at_pos() can fail; handle that case instead of
    passing an invalid GtkTreePath.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=657366
    https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/830185

 src/nautilus-places-sidebar.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c
index 81aa9ec..6149d6f 100644
--- a/src/nautilus-places-sidebar.c
+++ b/src/nautilus-places-sidebar.c
@@ -2892,14 +2892,20 @@ bookmarks_button_press_event_cb (GtkWidget             *widget,
 		GtkTreeIter iter;
 		GtkTreeView *tree_view;
 		NautilusWindowOpenFlags flags = 0;
+		gboolean res;
 
 		tree_view = GTK_TREE_VIEW (widget);
 		g_assert (tree_view == sidebar->tree_view);
 
 		model = gtk_tree_view_get_model (tree_view);
 
-		gtk_tree_view_get_path_at_pos (tree_view, (int) event->x, (int) event->y, 
-					       &path, NULL, NULL, NULL);
+		res = gtk_tree_view_get_path_at_pos (tree_view, (int) event->x, (int) event->y, 
+						     &path, NULL, NULL, NULL);
+
+		if (!res) {
+			return FALSE;
+		}
+
 		gtk_tree_model_get_iter (model, &iter, path);
 
 		if (g_settings_get_boolean (nautilus_preferences,



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