On Tue, 2013-09-03 at 22:14 +0100, Chris Vine wrote: > On Tue, 03 Sep 2013 22:34:51 +0200 > Murray Cumming <murr...@murrayc.com> wrote: > > On Tue, 2013-09-03 at 21:20 +0100, Chris Vine wrote: > > > On Tue, 03 Sep 2013 09:40:19 +0200 > > > Murray Cumming <murr...@murrayc.com> wrote: > > > > On Mon, 2013-09-02 at 16:13 +0200, Krzysztof Kosiński wrote: > > > > > 2013/9/2 Kjell Ahlstedt <kjell.ahlst...@bredband.net>: > > > > > > Objects of classes that derive from Gtk::Object are not put in > > > > > > Glib::RefPtr<>s. I'm not sure why. > > > > > > > > > > I'm also a little confused by this but it probably has > > > > > something to do with Gtk::manage(). > > > > > > > > GtkWidgets don't use simple reference counting in the GTK+ C API. > > > > They can be destroyed at any time regardless of the reference > > > > count. So we can't use RefPtr with them easily. > > > > > > That is not really true. widgets are always (and only) destroyed > > > when their sunk reference count reaches 0, > > > > Calling gtk_widget_destroy() will destroy a widget. Containers destroy > > their child widgets by default in GTK+ with C. > > On reflection I think you may well be right (except that it _is_ the > case that widgets will only be finalized when their reference count > reaches 0). gtk_widget_destroy() calls g_object_run_dispose() which > causes the object to drop all references to other objects. This will > cause all containers to drop their references to it. However, if the > references dropped includes other objects which are part of the > widget's own implementation then there are problems. > > The documentation for gtk_widget_destroy() sort-of suggests that > keeping a reference will keep the widget alive: "... If the widget is > inside a container, the widget will be removed from the container. If > the widget is a toplevel (derived from GtkWindow), it will be removed > from the list of toplevels, and the reference GTK+ holds to it will be > removed. Removing a widget from its container or the list of toplevels > results in the widget being finalized, unless you've added additional > references to the widget with g_object_ref()." It would be somewhat > pointless to not finalize the widget if in fact it is unusable. At a > suitable opportunity I will do a test and see which result occurs. > > However, GTK+ containers don't call gtk_widget_destroy(): users do. > GTK+ containers just drop their references when being finalized. > > Chris > _______________________________________________ > gtkmm-list mailing list > gtkmm-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtkmm-list
Thank you all. Do you have something on how to wrap a gpointer argument? Regards, Juan. _______________________________________________ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list