Segfault on gtk_tree_store_move_after


does anybody know, why in the following code a segfault on "gtk_tree_store_move_after()" occurs? The Store has 3 Items on the same level. When I now select the second item and call "selection_move_up()", I get the segfault.

GTK is 2.4.1


void selection_move_up (GtkTreeView* treeview)
   GtkTreeIter *iter= malloc (sizeof (GtkTreeIter));
   GtkTreeIter *next;
   GtkTreePath *path;
   GtkTreeModel *model= gtk_tree_view_get_model (treeview);
   GtkTreeSelection *selection = gtk_tree_view_get_selection (treeview);
   if( !gtk_tree_model_get_iter_first (model, iter) ) return;
for(next= gtk_tree_iter_copy(iter); gtk_tree_model_iter_next (model, next); ) {
       path= gtk_tree_model_get_path (model, next);
       if( gtk_tree_selection_path_is_selected (selection, path) ) {
debug_printf (DEBUG_INFORMATIONAL, "selection_move_up: change two iter\n");
           gtk_tree_store_move_after(GTK_TREE_STORE (model), iter, next);
           gtk_tree_iter_free (next);
           next= gtk_tree_iter_copy (iter);
       } else {
           gtk_tree_iter_free (iter);
           iter= gtk_tree_iter_copy (next);
       gtk_tree_path_free (path);
   gtk_tree_iter_free (iter);
   gtk_tree_iter_free (next);

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