@@ -181,16 +181,40 @@ struct SIGC_API signal_impl
181
181
bool deferred_;
182
182
};
183
183
184
+ struct SIGC_API signal_impl_exec_holder
185
+ {
186
+ /* * Increments the execution counter of the parent sigc::signal_impl object.
187
+ * @param sig The parent sigc::signal_impl object.
188
+ */
189
+ inline signal_impl_exec_holder (signal_impl* sig) noexcept
190
+ : sig_(sig)
191
+ {
192
+ sig_->reference_exec ();
193
+ }
194
+
195
+ signal_impl_exec_holder (const signal_impl_exec_holder& src) = delete ;
196
+ signal_impl_exec_holder operator =(const signal_impl_exec_holder& src) = delete ;
197
+
198
+ signal_impl_exec_holder (signal_impl_exec_holder&& src) = delete ;
199
+ signal_impl_exec_holder operator =(signal_impl_exec_holder&& src) = delete ;
200
+
201
+ // / Decrements the reference and execution counter of the parent sigc::signal_impl object.
202
+ inline ~signal_impl_exec_holder () { sig_->unreference_exec (); }
203
+
204
+ protected:
205
+ // / The parent sigc::signal_impl object.
206
+ signal_impl* sig_;
207
+ };
208
+
184
209
// / Exception safe sweeper for cleaning up invalid slots on the slot list.
185
210
struct SIGC_API signal_impl_holder
186
211
{
187
212
/* * Increments the reference and execution counter of the parent sigc::signal_impl object.
188
213
* @param sig The parent sigc::signal_impl object.
189
214
*/
190
215
inline signal_impl_holder (const std::shared_ptr<signal_impl>& sig) noexcept
191
- : sig_(sig)
216
+ : sig_(sig), exec_holder_(sig.get())
192
217
{
193
- sig_->reference_exec ();
194
218
}
195
219
196
220
signal_impl_holder (const signal_impl_holder& src) = delete ;
@@ -199,12 +223,10 @@ struct SIGC_API signal_impl_holder
199
223
signal_impl_holder (signal_impl_holder&& src) = delete ;
200
224
signal_impl_holder operator =(signal_impl_holder&& src) = delete ;
201
225
202
- // / Decrements the reference and execution counter of the parent sigc::signal_impl object.
203
- inline ~signal_impl_holder () { sig_->unreference_exec (); }
204
-
205
226
protected:
206
227
// / The parent sigc::signal_impl object.
207
228
const std::shared_ptr<signal_impl> sig_;
229
+ signal_impl_exec_holder exec_holder_;
208
230
};
209
231
210
232
} /* namespace internal */
0 commit comments