[libsigcplusplus] slot_rep: Add and use unset_parent().



commit f2d4c1f86f37d8666cc14057fd8a85faa90177b1
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Apr 21 12:07:19 2016 +0200

    slot_rep: Add and use unset_parent().
    
    Because that is slightly clearer.

 sigc++/functors/slot.h      |    2 +-
 sigc++/functors/slot_base.h |    9 +++++++++
 2 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/sigc++/functors/slot.h b/sigc++/functors/slot.h
index 7b2bac9..2e8323e 100644
--- a/sigc++/functors/slot.h
+++ b/sigc++/functors/slot.h
@@ -275,7 +275,7 @@ struct visitor<slot<T_return, T_arg...>>
     const slot<T_return, T_arg...>& target)
   {
     if (target.rep_ && target.rep_->parent_ == action.action_.rep_)
-      target.rep_->set_parent(nullptr, nullptr);
+      target.rep_->unset_parent();
   }
 
   template <typename T_action>
diff --git a/sigc++/functors/slot_base.h b/sigc++/functors/slot_base.h
index 53e9b1c..c970352 100644
--- a/sigc++/functors/slot_base.h
+++ b/sigc++/functors/slot_base.h
@@ -112,6 +112,15 @@ public:
     cleanup_ = cleanup;
   }
 
+  /** See set_parent().
+   *
+   */
+  inline void unset_parent() noexcept
+  {
+    parent_ = nullptr;
+    cleanup_ = nullptr;
+  }
+
   /// Invalidates the slot and executes the parent's cleanup callback.
   void disconnect();
 


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