Dynamic adding childs to a treestore


I'm trying to build a Gtk::TreeStore object dynamically which is filled with records from a mysql table

code I'm using to build the TreeStore:

for ( vector<mysqlpp::Row>::iterator it = result.begin(); it != result.end(); ++it) { const Gtk::TreeModel::Row* runchild = source->appendRow((string)it->at(0),it->at(1),NULL);
        // getting unique runtimes of the model
        query = dbaseConnection->query();
query<<"select distinct basetime from modeldata where MID = "<<it->at(1);
for (vector<mysqlpp::Row>::iterator itr = runtime.begin(); itr != runtime.end(); ++itr) { const Gtk::TreeModel::Row* fcchild = source->appendRow((string)itr->at(0), 0,
                runchild );
In this part I'm calling the method appendRow, which is a method of my TreeView object

const Gtk::TreeModel::Row* sourceViewer::appendRow(string name, int id,
        const Gtk::TreeModel::Row* parent ) {
    const Gtk::TreeModel::Row* row;
    if ( parent == NULL ) {
        //Creates a new row at the end of the top-level.
        row  = &(*(sourceTreeStore->append()));
    } else {
        //Creates a child list
        row  = &(*(sourceTreeStore->append(parent->children())));
    return row;

As long as my third parameter = NULL, thus not creating a child everything is OK, but when adding a child I get a crash and the nect error

gtkmm:ERROR:treeiter.cc:214:const Gtk::TreeNodeChildren& Gtk::TreeRow::children() const: assertion failed: (!is_end_)

What is wrong here?????


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]