This time in gtk.TextIter.getTags(). This is about as succinct as I can make it:
module tb;
import std.stdio;
import glib.ListSG;
import gtk.Main;
import gtk.MainWindow;
import gtk.Layout;
import gtk.TextTag;
import gtk.TextView;
import gtk.TextBuffer;
import gtk.TextIter;
class Tb : MainWindow
{
TextView te;
TextBuffer tb;
ubyte[] ub;
// **************************************************************************
private static int nTags(TextIter ti)
{
writefln("ti %x", ti.getTextIterStruct()); // reports some non-null value
ListSG sll = ti.getTags(); // crashes here
writefln("sll.length %d", sll.length);
return sll.length();
}
// **************************************************************************
this()
{
super("TextIter.getTags() test");
Layout f = new Layout(null, null);
f.setSizeRequest(300,200);
te = new TextView();
tb = te.getBuffer();
//tb.addOnChanged(&bufferChanged);
te.setSizeRequest(290, 200);
te.setRightMargin(2);
te.doref();
f.put(te, 5, 5);
add(f);
showAll();
// ***************************************************************************
TextIter start = new TextIter();
TextIter end = new TextIter();
tb.getBounds(start, end);
// Remove following line and it works OK
nTags(start);
// ***************************************************************************
}
}
void main(string[] args)
{
Main.init(args);
new Tb();
Main.run();
}