Don't leak a treepath if the treeview is not populated yet

Signed-off-by: Federico Mena Quintero <federico@novell.com>
This commit is contained in:
Federico Mena Quintero 2009-09-11 13:25:29 -05:00 committed by Benjamin Otte
parent 35028b9f05
commit 442484a280

View File

@ -6265,12 +6265,13 @@ browse_files_select_first_row (GtkFileChooserDefault *impl)
GtkTreeIter dummy_iter; GtkTreeIter dummy_iter;
GtkTreeModel *tree_model; 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)); tree_model = gtk_tree_view_get_model (GTK_TREE_VIEW (impl->browse_files_tree_view));
if (!tree_model) if (!tree_model)
return; return;
path = gtk_tree_path_new_from_indices (0, -1);
/* If the list is empty, do nothing. */ /* If the list is empty, do nothing. */
if (gtk_tree_model_get_iter (tree_model, &dummy_iter, path)) 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); gtk_tree_view_set_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view), path, NULL, FALSE);