Make IsoDirIters take also a ref on the dir they iterate.

This commit is contained in:
Vreixo Formoso
2008-03-17 16:02:50 +01:00
parent 987fa4b323
commit 8b10d3107a
3 changed files with 11 additions and 0 deletions

View File

@ -203,6 +203,7 @@ int iso_dir_find_children(IsoDir* dir, IsoFindCondition *cond,
}
update_next(data);
iso_node_ref((IsoNode*)dir);
*iter = it;
return ISO_SUCCESS;
}

View File

@ -772,6 +772,7 @@ int iso_dir_get_children(const IsoDir *dir, IsoDirIter **iter)
return ISO_OUT_OF_MEM;
}
iso_node_ref((IsoNode*)dir); /* tak a ref to the dir */
*iter = it;
return ISO_SUCCESS;
}
@ -797,6 +798,7 @@ void iso_dir_iter_free(IsoDirIter *iter)
if (iter != NULL) {
iso_dir_iter_unregister(iter);
iter->class->free(iter);
iso_node_unref((IsoNode*)iter->dir);
free(iter);
}
}