On Thu, 14 Jan 2016 23:48:44 GMT, Gerald Nunn wrote:

On Thu, 14 Jan 2016 22:29:19 +0100, Mike Wey wrote:

Looks like the problem is that the handle/pointer is allocated on the gc
heap. and when the GC runs it collects the handle before finalizing the
RGBA class. So the handle/pointer isn't valid when rgba_free is called.

getDObject will just construct an new class for types not derived form
ObjectG.

Makes sense and thanks for the explanation. Coming from Java the difference between struct and class in terms of memory (stack versus heap) hasn't become intuitive yet.

Mike I also have the issue with the StyleContext getColor and getBackgroundColor. This issue though looks fairly pervasive in GtkD though as anywhere there is an out parameter with a class it follows the pattern of creating the struct first and then the class. I assume though that is all done by the code generator so it just needs to be fixed once and the code re-generated?