GtkTreeStore::insert_before() - Bug or doc error?

[email protected] ("AndrĂ© Jansen") Mon, 08 Aug 2011 01:10:15 +0200
Newsgroups php.gtk.general
Message-ID <[email protected]>
Hi all,

Referring to :
http://gtk.php.net/manual/en/gtk.gtktreestore.method.insert_before.php

Until now I had not used this method nor its companion insert_after() - 
the append() method being OK for my requirements. However, at some point 
I needed insert_before to solve a specific problem.

It failed to work however, the result being a rather messed up treeview 
and lots of warnings such as:
Gtk-CRITICAL **: gtk_tree_store_insert_before: assertion `G_NODE (sibling-
>user_data)->parent =3D=3D G_NODE (parent->user_data)' failed
Gtk-CRITICAL **: gtk_tree_store_set_value: assertion `VALID_ITER (iter, 
tree_store)' failed

Turns out that the argument order is wrong. According to the 
documentation the first argument is the sibling iter, the second is the 
parent. When I switched these two around, everything worked perfectly as 
intended.

This can be tested by running the script as given in the doc page cited 
above. It will result in warnings similar to the above, and the tree is 
not displayed as intended. Switch the parent and sibling arguments in the 
insert_before() calls around, and things will work.

The insert_after() method has the same problem.

The above applies to php-gtk 2.0.1 on NT 5.1 (aka XP), standard windows 
binary distribution. I am not sure if it is a bug in the distribution 
(and hence the docs are correct) or a documentation error.

Regards,
-- 
Andr=E9
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
Black Holes were created when God divided by zero.