After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 112090 - Adjustment after spinbutton causes segfault
Adjustment after spinbutton causes segfault
Status: RESOLVED NOTABUG
Product: gtkmm
Classification: Bindings
Component: general
2.2
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2003-05-02 16:41 UTC by Mark Dvoo
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Mark Dvoo 2003-05-02 16:41:09 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
Comment 1 Murray Cumming 2003-05-03 06:37:12 UTC
Shouldn't you also see a warning about the initialization being in the
wrong order?
Comment 2 Murray Cumming 2003-05-07 07:08:19 UTC
So do you agree that this is not a bug?
Comment 3 Mark Dvoo 2003-05-08 15:21:43 UTC
I never saw a warning printed to the screen.  If a warning is printed
that would be fine.
Comment 4 Murray Cumming 2003-05-09 09:32:09 UTC
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.