[Glade-users] segfault on gnome_app_set_contents

Damon Chaplin damon@karuna.uklinux.net
15 May 2003 11:12:35 +0100


On Wed, 2003-05-14 at 22:39, Xavier Bestel wrote:
> Le mer 14/05/2003 à 21:33, Damon Chaplin a écrit :
> > On Tue, 2003-05-13 at 14:32, Xavier Bestel wrote:
> > > I instantiate the GnomeApp, and if I do:
> > > 	gnome_app_set_contents(GNOME_APP(appwindow),
> > > glade_xml_get_widget(glade_xml_new("xav.glade", "dummylabel", NULL),
> > > "dummylabel"));
> > > 
> > > everything works. But if I replace "dummylabel" with "vbox1", I get a
> > > segfault (pasted at the end of the mail).
> >
> > You should remove vbox1 from its original position first, before adding
> > it to the GnomeApp. I'd guess that is causing the problem.
> 
> What do you mean by "removing" ? If I understand what's explained here:
> http://developer.gnome.org/doc/API/2.0/libglade/libglade-embedding.html
> glade_xml_new("xav.glade", "vbox1") should only create a widget
> hierarchy starting from vbox1.
> Or, stated otherwise: why is it working with "dummylabel", or like in
> the example in the libglade doc ?
> 
> How do I remove vbox1 if it has no parent ? Or perhaps I didn't get the
> concept of glade_xml_new() ?

Sorry, I forgot about that.

Anyway, I've had a look at it and it looks like a bug in GTK+.
gtk_viewport_realize() doesn't check if the adjustments have been
created.

You can work around it by turning off the 'Visible' property of 
appwindow. Then after the call to gnome_app_set_contents() call
gtk_widget_show (appwindow);

Damon