[gtkmm] Container::remove(widget) and reference()



At the moment, calling Gtk::Container::remove(widget), where widget is
manage()ed, will often cause that widget to be destroyed when it is
added to another container. This is more or less by design in GTK+,
which demands difficult reference-counting from the developer.

Some of you are doing an extra reference() to avoid this problem. I
think this situation is obviously wrong. In gtkmm 2.4, I will add a
reference() inside Gtk::Widget::remove() so that the widget will have
the same state after remove() as it would have after new(). Then you can
happily add it to another container, just like you added it to the
first.

This means that your workaround (adding a reference()) will then be
unnecessary and will actually cause lifetime problems. If you don't like
this, then you should have put something in bugzilla instead of silently
working around the problem.
 
-- 
Murray Cumming
www.murrayc.com
murrayc murrayc com




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