On Mon, 16 Jan 2017 22:31:34 +0100, Mike Wey wrote:

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;
}

I tried this approach but TreeModel class's doesn't take a GtkTreeModelFilter * . So I decided to make an instance of TreeModelFilter class but still segfaults.

filter.setVisibleFunc(cast(GtkTreeModelFilterVisibleFunc) & filterTree, null, null);
    bool filterTree(GtkTreeModelFilter gtkModel, GtkTreeIter gtkIter)
    {
        auto model1 = new TreeModelFilter(&gtkModel, false);
        auto it1 = new TreeIter(&gtkIterator, false);
        
        string artistName = to!string(model1.getValue(it1, 0));
        
        return true;
    }