On 01/14/2016 08:21 PM, Gerald Nunn wrote:

On Thu, 14 Jan 2016 19:53:57 +0100, Mike Wey wrote:

vte.setColors is copying the colors, so it shouldn't cause any problems.
I'll try finding out where is the error is coming from.

Thanks Mike, I just found the problem. It is ColorChooserT.setRgba. The current method is structured like this:

		GdkRGBA* outcolor = new GdkRGBA;
		
		gtk_color_chooser_get_rgba(getColorChooserStruct(), outcolor);
		
		color = ObjectG.getDObject!(RGBA)(outcolor);

If I change it to the following code, problem appears to be fixed in the sense that I can't reproduce it:

         color = new RGBA();

		gtk_color_chooser_get_rgba(getColorChooserStruct(), color.getRGBAStruct());

I'm not sure why my change fixes it, I only stumbled on this because there are very few spots where I use RGBA in my program and commenting stuff out narrowed it to one section where I pull colors from some ColorButtons. I made my change in the code because I know ObjectG.getDObject will return a new object if it can't find one and since this case is my definition new (since the struct is being created) I figure I'd try tweaking it.

I don't understand getDObject well enough though to say why this works?

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.