[gtkmm] Segfault on spin button initialisation



I've got a set up like this at the moment:

==Header==
class GtkImageOutput : public Gtk::Window {
public:
	GtkImageOutput();
protected:
	Gtk::Adjustment adj;
	Gtk::SpinButton zoom;
}

==Source==
GtkImageOutput::GtkImageOutput() :
	adj(1.0, 1.0, 4.0, 1.0, 2.0, 1.0),
	zoom(adj)
{
	..
}

This set up is fine and compiles, however if I have the declarations for adj 
and zoom in the opposite order, I get a segfault, stemming from 
"Gtk::SpinButton::SpinButton () from /usr/lib/libgtkmm-2.4.so.1". I can only 
presume that the initializations are getting reordered, and so when zoom(adj) 
is called, adj is still uninitialised. If so, is the correct behaviour from 
the compiler? It just seemed a little strange. I'm using gcc 3.3.4.

Thanks,
Richard
-- 
jrs65 __at__ cam . ac . uk



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