Re: [gtkmm] gtkmm segfaulting with g++ 3.3 and Gtk::Notebook



On Saturday 23 August 2003 10:27 pm, Morten Brix Pedersen wrote:
> Hi,
>
> I'm curious on why other people havn't experienced this as well, so I
> thought I wanted to mention it on the list, in case anyone can find a
> solution.
>
> I reported Debian bug #204833 concerning gtkmm segfaulting when using
> Gtk::Notebook and g++ 3.3. The URL, containing description and source
> file which reproduces the problem is here:
>
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=204833
>
> I believe it's more of a g++ 3.3 bug than a gtkmm bug, so I havn't
> reported the bug to gtkmm's bugzilla. But it would be great if someone
> with more knowledge on the gtkmm code could track the problem down to a
> smaller example, so the gcc bug can be fixed.

Morten,

There is a bug in your program - you should either have the Gtk::Label object 
as a member, or allocate it using new().  As you had coded it, the label goes 
out of scope and therefore ceases to exist once the constructor is finished.  
(You also never realised it by calling show_all().)

Doing that and making a call to show_all() makes it work correctly with 
g++-3.3.1.  (Actually, although as you had coded it, it didn't crash with 
g++3.2, it still didn't show the label and thus the notebook page even with a 
call to show_all(), because as soon as it is realised it ceases to exist).

That doesn't actually explain why it crashed with your code with O2 
optimisation, because when you call Gtk::Notebook_Helpers::Page::get_child() 
the label does exist.  But perhaps that is a result of sensible but 
aggressive optimisation rather than a bug with g++.  The backtrace showed an 
absurd address (this=0x1) for Notebook_Helpers::Page.

Chris.




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