Commit 2f5fbcd1 authored by Kristian Rietveld's avatar Kristian Rietveld

Make _get_iter invalidate iterators when FALSE is returned

parent 431987a2
......@@ -647,7 +647,10 @@ gtk_list_store_get_iter (GtkTreeModel *tree_model,
i = gtk_tree_path_get_indices (path)[0];
if (i >= g_sequence_get_length (seq))
return FALSE;
{
iter->stamp = 0;
return FALSE;
}
iter->stamp = priv->stamp;
iter->user_data = g_sequence_get_iter_at_pos (seq, i);
......
......@@ -1186,7 +1186,8 @@ gtk_tree_model_get_column_type (GtkTreeModel *tree_model,
* @iter: (out): the uninitialized #GtkTreeIter
* @path: the #GtkTreePath
*
* Sets @iter to a valid iterator pointing to @path.
* Sets @iter to a valid iterator pointing to @path. If @path does
* not exist, * @iter is set to an invalid iterator and %FALSE is returned.
*
* Return value: %TRUE, if @iter was set
*/
......
......@@ -2318,6 +2318,7 @@ gtk_tree_model_filter_get_iter_full (GtkTreeModel *model,
{
if (!level || indices[i] >= level->array->len)
{
iter->stamp = 0;
return FALSE;
}
......@@ -2375,6 +2376,7 @@ gtk_tree_model_filter_get_iter (GtkTreeModel *model,
{
if (!level || indices[i] >= level->visible_nodes)
{
iter->stamp = 0;
return FALSE;
}
......
......@@ -1092,13 +1092,19 @@ gtk_tree_model_sort_get_iter (GtkTreeModel *tree_model,
depth = gtk_tree_path_get_depth (path);
if (depth == 0)
return FALSE;
{
iter->stamp = 0;
return FALSE;
}
for (i = 0; i < depth - 1; i++)
{
if ((level == NULL) ||
(indices[i] >= level->array->len))
return FALSE;
{
iter->stamp = 0;
return FALSE;
}
if (g_array_index (level->array, SortElt, indices[i]).children == NULL)
gtk_tree_model_sort_build_level (tree_model_sort, level, indices[i]);
......
......@@ -560,13 +560,19 @@ gtk_tree_store_get_iter (GtkTreeModel *tree_model,
parent.user_data = priv->root;
if (!gtk_tree_store_iter_nth_child (tree_model, iter, &parent, indices[0]))
return FALSE;
{
iter->stamp = 0;
return FALSE;
}
for (i = 1; i < depth; i++)
{
parent = *iter;
if (!gtk_tree_store_iter_nth_child (tree_model, iter, &parent, indices[i]))
return FALSE;
{
iter->stamp = 0;
return FALSE;
}
}
return TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment