diff options
author | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2019-12-15 15:43:37 +0100 |
---|---|---|
committer | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2019-12-15 15:43:37 +0100 |
commit | dc92d02f4d50851a1af59e5fbe2a753dcfd2e9df (patch) | |
tree | 22c2a978fbd97cdc5ef23dba76eb02fbe641263b /glib/src/binding.hg | |
parent | 2f4a122fa05e9e6514f62112d75d1ee7e4d894f2 (diff) | |
download | glibmm-dc92d02f4d50851a1af59e5fbe2a753dcfd2e9df.tar.gz |
Glib::Binding: Keep a binding alive even without a RefPtr
A binding between properties can remain even after all RefPtr<Binding>s
are gone. This is similar to how Gtk::Widget::set_controller() works
in gtkmm4.
Fixes #62, see !21
Diffstat (limited to 'glib/src/binding.hg')
-rw-r--r-- | glib/src/binding.hg | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/glib/src/binding.hg b/glib/src/binding.hg index c6849e17..98bc3fc6 100644 --- a/glib/src/binding.hg +++ b/glib/src/binding.hg @@ -29,7 +29,7 @@ namespace Glib /** Bind two object properties. * - * Glib::Binding is the representation of a binding between a property on a + * %Glib::Binding is the representation of a binding between a property on a * Glib::ObjectBase instance (or source) and another property on another Glib::ObjectBase * instance (or target). Whenever the source property changes, the same * value is applied to the target property; for instance, the following binding: @@ -90,10 +90,11 @@ 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 the two properties is broken whenever either one of the + * Glib::ObjectBase instances it refers to is deleted or when unbind() is called. + * If a RefPtr<Binding> remains after the binding has been broken, get_source() + * and get_target() return a <tt>nullptr</tt>. It's not necessary to keep a + * RefPtr<Binding> in order to keep the binding alive. * * @newin{2,44} */ @@ -407,13 +408,6 @@ public: _WRAP_PROPERTY("target", Glib::RefPtr<Glib::ObjectBase>, newin "2,44") _WRAP_PROPERTY("target-property", Glib::ustring, newin "2,44") -#ifndef DOXYGEN_SHOULD_SKIP_THIS - /** Decrement the reference count for this object. - * You should never need to do this manually - use the object via a RefPtr instead. - */ - void unreference() const override; -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - private: // The functor TransformProp can be implicitly converted to a SlotTransform // and used in a call to bind_property_value(). |