Re: Unexplainable crashes with GtkTreeModelSort
- From: Tim Müller <zen18864 zen co uk>
- To: Dimitar Haralanov <voidtrance comcast net>, gtk-app-devel-list gnome org
- Subject: Re: Unexplainable crashes with GtkTreeModelSort
- Date: Mon, 19 Jan 2004 02:46:01 +0000
On Monday 19 January 2004 02:13, Dimitar Haralanov wrote:
I think that I might have found where the problem stems from...
According to the documentation, gtk_tree_path_next advances the path
pointer to the next path. However, it never checks whether it is valid
or even exists. Therefore, when I use gtk_tree_model_get_iter
with the invalid path, I get a crash.
Considering that this is not the behaviour of gtk_tree_path_prev, I
consider this to be a major bug in GTK.
If this is not a bug but an intended feature, please, someone tell me
how to guard against using invalid paths...
Check the return value of gtk_tree_model_get_iter(). If it is TRUE, the path
was valid, if it is FALSE, the path doesn't exist.
Or use iters from the start and then gtk_tree_model_iter_next() (with checking
the return value).
gtk_tree_path_next() and _prev() cannot check whether a tree path is valid,
because they are not bound to a specific model. gtk_tree_path_prev() also
doesn't check whether a row really exists (you can construct an arbitrary new
tree path and then do _prev() and still get an invalid tree path), it just
returns FALSE if it's at the first node at the current depth already.
Cheers
-Tim
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]