On 01/16/2017 08:48 PM, Erdem wrote:

I'd like to filter Treeview data according to user input. But when I execute this program it gives this error:

Gtk-CRITICAL **: gtktreemodelfiltergetvalue: assertion `GTKTREEMODELFILTER (model)->priv->stamp == iter->stamp' failed
(Segmentation fault)

What should I pass exactly to setVisibleFunc? I was expecting to pass filtered data and an iterator.

Also is cast(GtkTreeModelFilterVisibleFunc) part really needed?

Here is the complete example program.

Yes, the cast is necessary and unfortunately the callback receives the C
arguments, this is probably what is causing the problems.

filter.setVisibleFunc(cast(GtkTreeModelFilterVisibleFunc) &filterTree, 
null, null);

bool filterTree(GtkTreeModelFilter gtk_model, GtkTreeIter gtk_iter)
{
     model1 = new TreeModel(gtk_model);
     it1 = new TreeIter(gtk_iter);

     string artistName = to!string(model1.getValue(it1, 0));
     return true;
}