Skip to content

Commit 2f5d337

Browse files
committed
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.
1 parent 4acf00f commit 2f5d337

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

sigc++/functors/slot.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ struct typed_slot_rep : public slot_rep
8585
/** Detaches the stored functor from the other referred trackables and destroys it.
8686
* This does not destroy the base slot_rep object.
8787
*/
88-
static void destroy(notifiable* data)
88+
static void destroy(slot_rep* data)
8989
{
9090
auto self_ = static_cast<self*>(data);
9191
self_->call_ = nullptr;

sigc++/functors/slot_base.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ struct SIGC_API slot_rep : public trackable
6868

6969
using hook_dup = slot_rep* (*)(slot_rep*);
7070

71-
inline slot_rep(hook call__, notifiable::func_destroy_notify destroy__, hook_dup dup__) noexcept
71+
using func_slot_rep_destroy_notify = void (*)(slot_rep* data);
72+
73+
inline slot_rep(hook call__, func_slot_rep_destroy_notify destroy__, hook_dup dup__) noexcept
7274
: call_(call__),
7375
cleanup_(nullptr),
7476
parent_(nullptr),
@@ -142,17 +144,17 @@ struct SIGC_API slot_rep : public trackable
142144
hook call_;
143145

144146
/** Callback of parent_. */
145-
func_destroy_notify cleanup_;
147+
notifiable::func_destroy_notify cleanup_;
146148

147149
/** Parent object whose callback cleanup_ is executed on notification. */
148150
notifiable* parent_;
149151

150152
protected:
151153
/// Callback that detaches the slot_rep object from referred trackables and destroys it.
152-
/* This could be a replaced by a virtual dtor. However since this struct is
153-
* crucual for the efficiency of the whole library we want to avoid this.
154+
/* This could be a replaced by a virtual dtor. However, since this struct is
155+
* crucial for the efficiency of the whole library, we want to avoid this.
154156
*/
155-
func_destroy_notify destroy_;
157+
func_slot_rep_destroy_notify destroy_;
156158

157159
private:
158160
/** Callback that makes a deep copy of the slot_rep object.

0 commit comments

Comments
 (0)