Re: gtk_container_remove - issues
- From: Dave Malcolm <david davemalcolm demon co uk>
- To: Joseph Turner <joeman leederville net>
- Cc: gtk-devel-list gnome org
- Subject: Re: gtk_container_remove - issues
- Date: 26 Jan 2004 17:49:00 +0000
On Mon, 2004-01-26 at 17:23, Joseph Turner wrote:
> Hello,
> In regards to gtk_container/destroy bits.
> I think I understand what you are talking about. Notes I've looked at on
> the web say that this will destroy the widget (unless special measures
> are taken to stop this).
>
> I've tried replacing with gtk_widget_destroy and get the same 'Critical'
> warnings.
>
> The warnings don't mention what widget they are referring to, doesn't
> seem to be an easy way to determine what part of my program
> they are actually referring. IS there a way to trace what widgets
> are getting destroyed?
You might like to try putting a breakpoint on the function "g_logv".
This is called by the innards to GTK/glib to print the warnings (along
with calls to g_message etc). When it hits the breakpoint you can then
look back up the stack to see what's causing each warning (though you
may need to have GTK built with debugging info in order to get useful
results from this)
Hope this helps
>
> I've tried some of the code below
>
> GList *list;
> GtkWidget *wid;
> list = gtk_container_children(GTK_CONTAINER(widget));
>
> while ( list ) {
> wid = GTK_WIDGET(list->data);
>
> if GTK_IS_VBOX(wid)
> {
> g_print("We have a vbox!!\n");
> if (GTK_IS_CONTAINER(wid))
> {
> g_print("vbox is a container!\n");
> debug_container_widgets(wid);
> }
> //gtk_widget_destroy(wid);
> }
> if GTK_IS_SHEET(wid)
> {
> g_print("We have a sheet!!\n");
> g_object_unref(G_OBJECT(wid));
> // gtk_widget_destroy(wid);
> }
> if GTK_IS_TEXT_VIEW(wid) g_print("We have a Text View!!\n");
>
>
>
> list = list->next;
> }
>
>
> to try and determine what is happening, but it is hard to determine
> _where_ the error is actually coming from.
>
>
> Cheers
>
> Joe
>
> On Tue, Jan 27, 2004 at 01:11:54AM +0000, John Cupitt wrote:
> > Hi, the container_remove will end up doing an unref on the child widget,
> > and this is (for slightly complicated reasons) seldom what you want. The
> > right way to destroy a widget is to call gtk_widget_destroy() on it ...
> > this should automagically work.
> > The container_remove() stuff is actually lower level and only useful if you
> > are implementing your own container widget.
> >
> > John
> >
> > Joseph Turner wrote:
> > >Hello,
> > >In relation to my post about 1 hour ago, regarding the
> > >deletion of child widgets within a container.
> > >
> > >The widgets I suspect are the cause ar ethe TEXT_VIEW widgets
> > >within the gtksheet (2) table. I've done an 'attach' of the
> > >widgets to the sheet. If before hand I dp a gtk_sheet_delete_columns
> > >I get rid of some of the errors.
> > >
> > >So it appears to me that when the gtk_container_remove gets to the
> > >widgets in the sheet it has issues.
> > >
> > >Any ideas?
> > >
> > >Cheers
> > >
> > >Joe
> > >
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]