[Boost-bugs] [Boost C++ Libraries] #9103: execution of slots on deletion of signals

Subject: [Boost-bugs] [Boost C++ Libraries] #9103: execution of slots on deletion of signals
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-09-11 12:47:38


#9103: execution of slots on deletion of signals
---------------------+------------------------------
 Reporter: wim@… | Type: Bugs
   Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.54.0
 Severity: Problem | Keywords:
---------------------+------------------------------
 This code:
   struct A {
   public:
     A() {
       sig.connect(0, boost::bind(&A::a, this));
       sig.connect(1, &A::b);
     }
     void a() {delete this;}
     static void b() {std::cout << "hello\n";}
     boost::signals2::signal<void(void)> sig;
   };
   A *a = new A;
   a->sig();

 Does not print 'hello'.

 Yet, the documentation of boost.signals2 states:


 Signal/slot disconnections occur when any of these conditions occur:

 (1) The connection is explicitly disconnected via the connection's
 disconnect method directly, or indirectly via the signal's disconnect
 method, or scoped_connection's destructor.

 (2) An object tracked by the slot is destroyed.

 (3) The signal is destroyed.

 [Note: we're in case (3)]

 These events can occur at any time without disrupting a signal's calling
 sequence. If a signal/slot connection is disconnected at any time during a
 signal's calling sequence, the calling sequence will still continue but
 will not invoke the disconnected slot. Additionally, a signal may be
 destroyed while it is in a calling sequence, and which case it will
 complete its slot call sequence but may not be accessed directly.


 Since the slot is deleted in the calling sequence, I expect the calling
 sequence to continue, and 'hello' should be printed. This behaviour would
 be consistent with boost.signals (the deprecated version).

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9103>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:14 UTC