Re: [gtkmm] Deleting child widgets in a Gtk::Table



On Fri, 2004-04-30 at 10:48, Roger Leigh wrote:
> Murray Cumming <murrayc murrayc com> writes:
> 
> > On Wed, 2004-04-28 at 18:47, Roger Leigh wrote:
> >> (epicpos:10851): Gtk-CRITICAL **: file gtkcontainer.c: line 983
> >> (gtk_container_remove): assertion `GTK_IS_WIDGET (widget)' failed
> >> 2,3,0,1 = overlap
> >> Deleting widget at 2,0
> >>   
> >> (epicpos:10851): Gtk-CRITICAL **: file gtkcontainer.c: line 983
> >> (gtk_container_remove): assertion `GTK_IS_WIDGET (widget)' failed
> >> 
> >> The widget with top-left corner (2,1) was skipped.  Am I using the
> >> TableList::erase method incorrectly?  Are the iterators invalidated by
> >> an erase()?
> >
> > With gtkmm 2.0/2.2, if the child widget is manage()ed, you'll need to do
> > a reference() on the child widget before calling remove(), to keep it
> > alive. Hopefully that's helpful. This is fixed in gtkmm 2.4.
> 
> This works.  I did
> 
>   widget->reference();
>   remove(*widget);
>   widget->unreference();

The unreference() should not be necessary, I think.

> and all works fine.  I'll try to upgrade to 2.4 ASAP.

-- 
Murray Cumming
www.murrayc.com
murrayc murrayc com




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