On Thu, 13 Sep 2018 at 12:01, Daniel Kasak via gtk-perl-list < gtk-perl-list@gnome.org> wrote:
> Hi all. I've been looking at a long-standing bug in one of my libraries, > triggered when I delete multiple rows from a tree model. After looking > closer, my original bug appears to be caused by the fact that after going: > > $model->remove( $iter ); > > ... $iter is now pointing at the *next* row, without me having to go: > > $model->iter_next( $iter ); > > Just like the documentation[0] for gtk_list_store_remove() says. > So this initially seemed to be easy to solve - just don't call iter_next() > if I've deleted a row. But ... I was previously exiting the loop, based on > the return of $model->iter_next( $iter ). If there are no more rows, this > call returns false. Since I'm not calling it for deleted rows, and since > $iter is still 'set' in this case, how do I know if I'm at the end of the > model? > Use the return value of `Gtk::ListStore::remove()` to see if the iterator is still valid or not. Ciao, Emmanuele. [0]: https://developer.gnome.org/gtk3/stable/GtkListStore.html#gtk-list-store-remove -- https://www.bassi.io [@] ebassi [@gmail.com]
_______________________________________________ gtk-perl-list mailing list gtk-perl-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-perl-list