Removing a managed child in Gtk::Bin



Hi,

The doc specifies that Gtk::Container::Remove(Gtk::Widget*) does not frees managed widgets. As the method is called with a parameter it is not difficult to delete the pointer aftewards.

With Gtk::Bin::Remove(), there is no parameter. Can I expect the method to delete the contained widget (given that it is managed), or shall I delete it myself ? If so, how ?

solution 1:
Gtk::Widget *content = mybin.get_child();
mybin.remove();
delete content;

solution 2:
delete mybin.get_child(); // will the bin know that its child does not exist anymore ?

solution 3:
mybin.get_child()->unreference(); // will it delete the widget ?

I'm looking for the cleanest (and if possible shortest) solution.

Thanks,
yann


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