GNOME Bugzilla – Bug 112090
Adjustment after spinbutton causes segfault
Last modified: 2004-12-22 21:47:04 UTC
In my class, I declare both a Gtk::Adjustment and a Gtk::SpinButton. If I declare the Gtk::SpinButton before I declare a Gtk::Adjustment, I get a segfault. But if I reverse them (declare the adjustment first), then the program runs fine: This below causes a segfault, but like I said, in the class, declaring the Adjustment first causes this to work. class PTab : public Gtk::VBox { public: PTab(); virtual ~PTab(); protected: Gtk::SpinButton m_SButton; Gtk::Adjustment m_Adjust; }; PTab::PTab() : m_Adjust(0.0, -360.0, 360.0, 1.0, 10.0, 0.0), m_SpinButton(m_Adjust) { } // Running RedHat 7.2 with custom built: gtk+-2.2.1 gtkmm-2.2.0 /Line72
Shouldn't you also see a warning about the initialization being in the wrong order?
So do you agree that this is not a bug?
I never saw a warning printed to the screen. If a warning is printed that would be fine.
I mean a wanring from the compiler. I guess the old gcc 2.95 in RedHat 7.2 doesn't do this. So, I believe this is a basic C++ error, so I'm closing the bug. Please reopen if you discover otherwise. Also look out for the gcc 2.95 dynamic_cast<> bug mentioned in the gtkmm FAQ. I also think valgrind is helpful for this kind of thing.