On Wed, Jul 05, 2006 at 01:09:19AM +0100, Christopher Backhouse wrote:
> My previous email on this subject was rubbish and unspecific, sorry for 
> the spam. So - I have reduced my code down to the smallest test case and 
> now hope someone can help me.
> 
> #include "gtk/gtk.h"
> int main(int argc, char **argv)
> {
>       gtk_init(&argc, &argv);
> 
>       //make a store and view stick them together, add a column
>       GtkListStore* store=gtk_list_store_new(1,G_TYPE_STRING);
>       GtkTreeView* view=(GtkTreeView*)gtk_tree_view_new();
>       gtk_tree_view_set_model(view,(GtkTreeModel*)store);
>       GtkTreeViewColumn* column=gtk_tree_view_column_new();
>       gtk_tree_view_append_column(view,column);
> 
>       //check get_visible_range, all is well
>       GtkTreePath* sp;
>       GtkTreePath* ep;
>       gtk_tree_view_get_visible_range(view,&sp,&ep);
>               
>       //add one row
>       GtkTreeIter iter;
>       gtk_list_store_append(store,&iter);
>       gtk_list_store_set(store,&iter,0,"foo",-1);
>               
>       //check again, bad things
>       gtk_tree_view_get_visible_range(view,&sp,&ep);
> }
> 
> 
> The errors are:
> 
> (a.out:5709): Gtk-CRITICAL **: _gtk_tree_view_find_path: assertion `node 
> != NULL' failed
> 
> (a.out:5709): Gtk-CRITICAL **: _gtk_tree_view_find_path: assertion `node 
> != NULL' failed
> 
> As I said before - in the full version everything seems to work as 
> expected except for these errors.

What do you exactly expect from gtk_tree_view_get_visible_range()
when the tree view is not realized, has no size allocated,
etc. (beside a more helpful error message)?  What is
*visible* then?

The first gtk_tree_view_get_visible_range() fails gracefully
(note it returns FALSE) simply because empty tree is
special-cased.

The errors disappear if you do for example

    GtkWidget *window;
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
    gtk_widget_show_all(window);

first.

Yeti


--
Anonyms eat their boogers.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to