From 9682c4d79c200408d18336a84f3312f19738baf1 Mon Sep 17 00:00:00 2001 From: Daniel Boles Date: Mon, 18 Nov 2019 11:22:34 +0000 Subject: Binding: Clarify need to hold ref, poss empty objs and move the documentation on lifetime away from bind_property_value() up to the class description/intro. https://gitlab.gnome.org/GNOME/glibmm/issues/62 --- glib/src/binding.hg | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/glib/src/binding.hg b/glib/src/binding.hg index c6849e17..f88e254e 100644 --- a/glib/src/binding.hg +++ b/glib/src/binding.hg @@ -90,10 +90,13 @@ namespace Glib * various ways of blocking a signal emission, like Glib::SignalProxyNormal::emission_stop() * or g_signal_handler_block(). * - * A binding will be severed, and the resources it allocates freed, whenever - * either one of the Glib::ObjectBase instances it refers to is deleted, - * when unbind() is called, or when the Glib::Binding instance loses - * its last reference. + * The binding between properties is broken, and its resources freed, when the + * Glib::Binding loses its last Glib::RefPtr, the source or target object is + * deleted, or unbind() is called. If a Glib::RefPtr to the Glib::Binding + * remains after the binding is broken another way, Glib::Binding::get_source() + * and Glib::Binding::get_target() return an empty Glib::RefPtr. So, you must + * keep a Glib::RefPtr to the Glib::Binding for as long as you want it to bind, + * but doing that does not guarantee the source/target are still alive or bound. * * @newin{2,44} */ @@ -148,10 +151,6 @@ public: * will be updated as well. The @a transform_from function is only used in case * of bidirectional bindings, otherwise it will be ignored. * - * The binding will automatically be removed when either the source or the - * target instance is deleted. To remove the binding without affecting the - * source and the target you can call unbind() on the returned Binding instance. - * * A Glib::ObjectBase instance can have multiple bindings. * * If you supply transformation functions, it is usually easier to use one of the -- cgit v1.2.1