@@ -371,14 +371,8 @@ struct signal_emit<void, void, T_arg...>
371
371
372
372
} /* namespace internal */
373
373
374
- // TODO: When we can break ABI, let signal_base instead of signal_with_accumulator
375
- // derive from trackable, as in sigc++2. One of them must derive from trackable.
376
- // Otherwise the slot returned from signal_with_accumulator::make_slot() is not
377
- // automatically disconnected when the signal is deleted.
378
- // https://github.com/libsigcplusplus/libsigcplusplus/issues/80
379
-
380
374
/* * Signal declaration.
381
- * % signal_with_accumulator can be used to connect() slots that are invoked
375
+ * signal_with_accumulator can be used to connect() slots that are invoked
382
376
* during subsequent calls to emit(). Any functor or slot
383
377
* can be passed into connect(). It is converted into a slot
384
378
* implicitly.
@@ -402,9 +396,7 @@ struct signal_emit<void, void, T_arg...>
402
396
* @ingroup signal
403
397
*/
404
398
template <typename T_return, typename T_accumulator, typename ... T_arg>
405
- class signal_with_accumulator
406
- : public signal_base
407
- , public trackable
399
+ class signal_with_accumulator : public signal_base
408
400
{
409
401
public:
410
402
using slot_type = slot<T_return(T_arg...)>;
@@ -469,6 +461,11 @@ class signal_with_accumulator
469
461
}
470
462
471
463
/* * Creates a functor that calls emit() on this signal.
464
+ *
465
+ * @note %sigc::signal does not derive from sigc::trackable in sigc++3.
466
+ * If you connect the returned functor (calling %emit() on signal1) to
467
+ * another signal (signal2) and then delete signal1, you must manually
468
+ * disconnect signal1 from signal2 before you delete signal1.
472
469
*
473
470
* @code
474
471
* sigc::mem_fun(mysignal, &sigc::signal_with_accumulator::emit)
@@ -488,28 +485,19 @@ class signal_with_accumulator
488
485
489
486
signal_with_accumulator () = default ;
490
487
491
- signal_with_accumulator (const signal_with_accumulator& src) : signal_base(src), trackable(src) {}
488
+ signal_with_accumulator (const signal_with_accumulator& src) : signal_base(src) {}
492
489
493
- signal_with_accumulator (signal_with_accumulator&& src)
494
- : signal_base(std::move(src)), trackable(std::move(src))
495
- {
496
- }
490
+ signal_with_accumulator (signal_with_accumulator&& src) : signal_base(std::move(src)) {}
497
491
498
492
signal_with_accumulator& operator =(const signal_with_accumulator& src)
499
493
{
500
494
signal_base::operator =(src);
501
- // Don't call trackable::operator=(src).
502
- // It calls notify_callbacks(). This signal is not destroyed.
503
495
return *this ;
504
496
}
505
497
506
498
signal_with_accumulator& operator =(signal_with_accumulator&& src)
507
499
{
508
500
signal_base::operator =(std::move (src));
509
- if (src.impl_ != impl_)
510
- src.notify_callbacks ();
511
- // Don't call trackable::operator=(std::move(src)).
512
- // It calls notify_callbacks(). This signal is not destroyed.
513
501
return *this ;
514
502
}
515
503
};
@@ -543,7 +531,7 @@ class signal_with_accumulator
543
531
* @par Example:
544
532
* @code
545
533
* void foo(int) {}
546
- * sigc::signal<void( long) > sig;
534
+ * sigc::signal<void, long> sig;
547
535
* sig.connect(sigc::ptr_fun(&foo));
548
536
* sig.emit(19);
549
537
* @endcode
0 commit comments