treeview weird error



Hi, I made a button to delete one row of the tree. This is the function:

    Glib::RefPtr<Gtk::TreeSelection> m_refTreeSelection;
    m_refTreeSelection = get_selection();
    Gtk::TreeModel::iterator iterselected =
m_refTreeSelection->get_selected();

    //save the children before we kill one of the child
    Gtk::TreeModel::Children children =
iterselected->parent()->children();

    //don't delete if there's only one child
    if(children.size()==1)
	return;

    //erase the child
    m_refTreeModel->erase( iterselected );

    //reiterate the children row and fix the number after the deletion
    int num = 0;
    for(Gtk::TreeModel::Children::iterator iter=children.begin(); iter!
=children.end(); iter++) 
    {
	Gtk::TreeModel::Row row = *iter;
	row[m_Columns.m_col_no] = ++num;
    }

Every time I run this function, I got this error on console:
(wallpapoz:6605): Gtk-CRITICAL **: gtk_tree_store_iter_parent: assertion
`child->user_data != NULL' failed

It happens in this line:
    //erase the child
    m_refTreeModel->erase( iterselected );

The program stil works properly, but I just don't feel comfortable with
this warning/error.

Any idea? Thank you.




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