]> Pileus Git - ~andy/gtk/commitdiff
Don't leak a treepath if the treeview is not populated yet
authorFederico Mena Quintero <federico@novell.com>
Fri, 11 Sep 2009 18:25:29 +0000 (13:25 -0500)
committerBenjamin Otte <otte@gnome.org>
Thu, 15 Oct 2009 20:06:18 +0000 (22:06 +0200)
Signed-off-by: Federico Mena Quintero <federico@novell.com>
gtk/gtkfilechooserdefault.c

index c8c4d2a5d6804d8b97e53af7fc09690e2fd71512..31991c085f2cee5fa7f89448826ad7b9ff715575 100644 (file)
@@ -6265,12 +6265,13 @@ browse_files_select_first_row (GtkFileChooserDefault *impl)
   GtkTreeIter dummy_iter;
   GtkTreeModel *tree_model;
 
-  path = gtk_tree_path_new_from_indices (0, -1);
   tree_model = gtk_tree_view_get_model (GTK_TREE_VIEW (impl->browse_files_tree_view));
 
   if (!tree_model)
     return;
 
+  path = gtk_tree_path_new_from_indices (0, -1);
+
   /* If the list is empty, do nothing. */
   if (gtk_tree_model_get_iter (tree_model, &dummy_iter, path))
       gtk_tree_view_set_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view), path, NULL, FALSE);