Re: [Vala] screen-changed signal emitted before constructor is invoked?



You should probably init you private member variable like this:

public class test : Object {

	// Set it here.
	public some_class var = new some_class();
	
	test()
	{
		....
	}
}

Yu Feng wrote:
Dear developers,

I created an Widget and overrode the constructor of the GObject
interface to initialize private members.

Then I listened to screen-changed signal of the widget. in the signal
handler a private member was accessed;
The private member was not properly initialized when the first
screen_changed signal is emitted. Later on I added debug messages in the
constructor and screen-changed signal handler; it turns out that the
handler was invoked *before* the constructor.

However, the construction of the GObject is not yet finished before the
constructor function is invoked (at least to my understanding); Should
this behavior be a bug?

This is a serious interference with VALA where there is no way to
specify the instance _init functions.
I am also ccing to vala-list to see if the vala gurus can advice with a
clean workaround.

Thanks,

Yu




_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list



--
Arto Karppinen
------------------------------
arto karppinen iki fi


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]