Don't ignore the fact that gtk_file_system_get_parent() may return NULL.

2007-05-01  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkfilesystemmodel.c (_gtk_file_system_model_path_do):
        Don't ignore the fact that gtk_file_system_get_parent()
        may return NULL.  (#424042, Jan Martinek)



svn path=/trunk/; revision=17764
This commit is contained in:
Matthias Clasen 2007-05-02 01:19:59 +00:00 committed by Matthias Clasen
parent 17274cbe88
commit 098f74dfb1
2 changed files with 13 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2007-05-01 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkfilesystemmodel.c (_gtk_file_system_model_path_do):
Don't ignore the fact that gtk_file_system_get_parent()
may return NULL. (#424042, Jan Martinek)
2007-05-01 Dan Winship <danw@novell.com>
* gdk/x11/gdkwindow-x11.c (setup_toplevel_window): Make sure the

View File

@ -1134,7 +1134,7 @@ out:
* @user_data: data to pass to @func
*
* Locates @path within @model, referencing
* (gtk_tree_model_ref_node ()) all parent nodes,
* (gtk_tree_model_ref_node()) all parent nodes,
* calls @func passing in the path and iter for @path,
* then unrefs all the parent nodes.
*
@ -1146,10 +1146,7 @@ out:
*
* This function is particularly useful for expanding
* a #GtkTreeView to a particular point in the file system.
*
* Return value: %TRUE if the path was successfully
* found in @model and @func was called.
**/
*/
void
_gtk_file_system_model_path_do (GtkFileSystemModel *model,
const GtkFilePath *path,
@ -1161,15 +1158,17 @@ _gtk_file_system_model_path_do (GtkFileSystemModel *model,
FileModelNode *node;
struct RefPathData *info;
if (gtk_file_path_compare (path, model->root_path) == 0
|| !gtk_file_system_get_parent (model->file_system, path, &parent_path, NULL))
if (gtk_file_path_compare (path, model->root_path) == 0 ||
!gtk_file_system_get_parent (model->file_system, path, &parent_path, NULL) ||
parent_path == NULL)
return;
paths = g_slist_prepend (paths, gtk_file_path_copy (path));
while (gtk_file_path_compare (parent_path, model->root_path) != 0)
{
paths = g_slist_prepend (paths, parent_path);
if (!gtk_file_system_get_parent (model->file_system, parent_path, &parent_path, NULL))
if (!gtk_file_system_get_parent (model->file_system, parent_path, &parent_path, NULL) ||
parent_path == NULL)
{
gtk_file_paths_free (paths);
return;