This will be failed in first loop, **how to get first TAG ?** **gtk_tree_model_get(model, &iter, SYMBOLS_COLUMN_TAG, &tag, -1);**
``` static void on_update_all_index(GtkWidget *widget, gpointer user_data) {
GtkTreeIter iter; GeanyDocument * doc = document_get_current(); gboolean cont = TRUE; gint line_num; gint index_chr = 0;
GtkTreeStore * store = doc->priv->tag_store; GtkTreeModel *model = GTK_TREE_MODEL(store);
unsigned int * seg = 0;
int count = 0; if (!gtk_tree_model_get_iter_first(model, &iter)){ return; } do { TMTag * tag; gtk_tree_model_get(model, &iter, SYMBOLS_COLUMN_TAG, &tag, -1); if(!tag){ cont = ui_tree_model_iter_any_next(model, &iter, TRUE); }else{ line_num = tag->line; #if 1 if(line_num >= 0){ index_chr++; //editor_udpate_chapter_index_quickly(doc->editor,index_chr,line_num); } #endif tm_tag_unref(tag); } } while (gtk_tree_model_iter_next(model, &iter)); } ```
What do you mean? ```gtk_tree_model_get_iter_first(model, &iter)``` is setting ```iter``` to the fist position. Where will it fail?
The question is not very clear, and the goal far from obvious, but note that in the symbols tree view there are headers (like *Functions*, *Classes*, *Structs*, etc.) that don't have tags attached, so it's expected getting the content of the TAG column for them yields `NULL`.
github-comments@lists.geany.org