Web lists-archives.com

GtkTreePath's gtk_tree_path_up() method returns true when called with "0" level path

Hello Gtk+ developers,

The following small C program(and the C++ counterpart) outputs "0->up() = true".

#include <stdio.h>
#include <gtk/gtk.h>

int main() {
        GtkTreePath *path = gtk_tree_path_new_from_string("0");
        printf("0->up() = %s\n", gtk_tree_path_up(path) ? "true" : "false");
        return 0;

#include <iostream>
#include <gtkmm/treepath.h>

using namespace std;
using namespace Gtk;

int main() {
        auto path = TreePath("0");
        cout << "0->up() = " << boolalpha << path.up() << endl;
        return 0;

The API documentation of "gtk_tree_path_up()" says


TRUE if path has a parent, and the move was made.

But according to the documentation again
Thus, the path 0refers to the root node and the path 2:4 refers to the fifth child of the third node.
Now, if the path "0" refers to root node, how can it have a parent to move to? After calling this method on path, the path isn't valid anymore and fails to be converted into iterator(critical warning is thrown). Is this behavior correct for gtk_tree_path_up() ?



gtk-devel-list mailing list