Re: [gtkmm] ListStore sorting and Gtk::TreeIter validity problems

On Saturday 31 July 2004 09:47, Samuel Abels wrote:
> (3) Most importantly: I am trying to somehow remove the currently
> selected row. But when using
> store->erase(get_selection()->get_selected());
> (the offending code is in GtkBookList::remove_selected())
> There is an error message
> (test:22738): Gtk-CRITICAL **: file gtkliststore.c: line 1013
> (gtk_list_store_remove): assertion `VALID_ITER (iter, list_store)'
> failed
> (This can be tested by clicking "delete" in the appended test.)

There should be no problem in principle with 

There appears to be another problems with your code, which may or may not be 
connected with this.  You should not store Gtk::TreeIter objects in a 
container for later use, as they can be invalidated by other operations on 
the tree model.  You should use a Gtk::TreeRowReference object or (if you are 
using gtkmm-2.0 rather than gtkmm-2.2 or gtkmm-2.4) wrap GtkTreeRowReference 
yourself.  They maintain their validity for as long as the row which is 
referenced is a valid row.

Your GtkBookList::remove_book() method is therefore likely to fail.  Have you 
mis-diagnosed the method in which the problem shows up?


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