[libsigcplusplus] slot_rep: Pass a slot_rep*, not notifiable*, to destroy().



commit 2f5d33724dd6806e4fc9b15c22ff15165a8780e9
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Apr 28 12:47:03 2016 +0200

    slot_rep: Pass a slot_rep*, not notifiable*, to destroy().
    
    To make it clearer exactly what callback signature is expected,
    and what the type of the data is.

 sigc++/functors/slot.h      |    2 +-
 sigc++/functors/slot_base.h |   12 +++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/sigc++/functors/slot.h b/sigc++/functors/slot.h
index 8807660..419cfa2 100644
--- a/sigc++/functors/slot.h
+++ b/sigc++/functors/slot.h
@@ -85,7 +85,7 @@ private:
   /** Detaches the stored functor from the other referred trackables and destroys it.
    * This does not destroy the base slot_rep object.
    */
-  static void destroy(notifiable* data)
+  static void destroy(slot_rep* data)
   {
     auto self_ = static_cast<self*>(data);
     self_->call_ = nullptr;
diff --git a/sigc++/functors/slot_base.h b/sigc++/functors/slot_base.h
index 57c44d9..317d080 100644
--- a/sigc++/functors/slot_base.h
+++ b/sigc++/functors/slot_base.h
@@ -68,7 +68,9 @@ public:
 
   using hook_dup = slot_rep* (*)(slot_rep*);
 
-  inline slot_rep(hook call__, notifiable::func_destroy_notify destroy__, hook_dup dup__) noexcept
+  using func_slot_rep_destroy_notify = void (*)(slot_rep* data);
+
+  inline slot_rep(hook call__, func_slot_rep_destroy_notify destroy__, hook_dup dup__) noexcept
     : call_(call__),
       cleanup_(nullptr),
       parent_(nullptr),
@@ -142,17 +144,17 @@ public:
   hook call_;
 
   /** Callback of parent_. */
-  func_destroy_notify cleanup_;
+  notifiable::func_destroy_notify cleanup_;
 
   /** Parent object whose callback cleanup_ is executed on notification. */
   notifiable* parent_;
 
 protected:
   /// Callback that detaches the slot_rep object from referred trackables and destroys it.
-  /* This could be a replaced by a virtual dtor. However since this struct is
-   * crucual for the efficiency of the whole library we want to avoid this.
+  /* This could be a replaced by a virtual dtor. However, since this struct is
+   * crucial for the efficiency of the whole library, we want to avoid this.
    */
-  func_destroy_notify destroy_;
+  func_slot_rep_destroy_notify destroy_;
 
 private:
   /** Callback that makes a deep copy of the slot_rep object.


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