On 12-11-2019 21:20, Ron Tarrant wrote:
I'm back banging on this bit of code that puts together a doubly-linked list of Pixbufs for use as Window icons, etc. I assemble the list, check the integrity of the list and everything seems fine. Then I pass it to Window.setIconList() and get the errors shown below.
Does this function work as intended? Am I assembling the ListG wrong?
string[] images = ["images/airport_25.png", "images/airport_35.png", "images/airport_60.png", "images/airport_100.png"]; ListG listG = new ListG(null); for(int i; i < images.length; i++) { string imageName = images[i]; Pixbuf pixbuf = new Pixbuf(imageName); listG = listG.append(cast(void*)pixbuf); } // check list integrity uint listLength = listG.length(); for(int i; i < listLength; i++) { Pixbuf pixbuf = cast(Pixbuf)listG.nthData(i); writeln("data: ", listG.nthData(i), ", width: ", pixbuf.getWidth()); } setIconList(listG);
This is where binding break down a little and setIconList expects a
linked list of the C structs.
Try changing this line:
listG = listG.append(cast(void*)pixbuf);
To:
listG = listG.append(cast(void*)pixbuf.getPixbufStruct());