connect boost::signals inside of a slot

Hi, If you connect (disconnect) a new slot to a signal inside of a slot of the same signal, what happens? - are the slots called which where connected before the signal was called, - or is new slot be called this time, too, - or is the behaviour undefined? I didn't find anything on this subject in the manuals. Even if the behaviour is undefined, that should be mentioned. Sebastian Setzer

Setzer, Sebastian (ext) wrote:
Hi, If you connect (disconnect) a new slot to a signal inside of a slot of the same signal, what happens? - are the slots called which where connected before the signal was called, - or is new slot be called this time, too, - or is the behaviour undefined?
I didn't find anything on this subject in the manuals. Even if the behaviour is undefined, that should be mentioned.
Doesn't the following answer the questions: http://www.boost.org/doc/html/signals/tutorial.html#id2732772 When can disconnections occur? (Intermediate) --------------------------------------------- ... 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. Signals may be invoked recursively (e.g., a signal A calls a slot B that invokes signal A...). The disconnection behavior does not change in the recursive case, except that the slot calling sequence includes slot calls for all nested invocations of the signal. Jeff Flinn

On May 18, 2006, at 7:53 AM, Setzer, Sebastian (ext) wrote:
Hi, If you connect (disconnect) a new slot to a signal inside of a slot of the same signal, what happens? - are the slots called which where connected before the signal was called, - or is new slot be called this time, too, - or is the behaviour undefined?
I didn't find anything on this subject in the manuals. Even if the behaviour is undefined, that should be mentioned.
It is unspecified whether that slot will be called this time or not. The "Notes" sentence of the connect function is meant to convey this, but the wording is rather poor: http://www.boost.org/doc/html/signalN.html#id2584315-bb Doug

If you connect (disconnect) a new slot to a signal inside of a slot of the same signal, what happens? - are the slots called which where connected before the signal was called, - or is new slot be called this time, too, - or is the behaviour undefined?
I didn't find anything on this subject in the manuals. Even if the behaviour is undefined, that should be mentioned.
It is unspecified whether that slot will be called this time or not. The "Notes" sentence of the connect function is meant to convey this, but the wording is rather poor:
http://www.boost.org/doc/html/signalN.html#id2584315-bb Thanks. The next time I'll look harder...sorry.
I assume there doesn't happen something evil (like if you use old iterators of std::vector after appending something), it's just not defined if the slot is called this time? Sebastian

On May 22, 2006, at 5:56 AM, Setzer, Sebastian (ext) wrote:
If you connect (disconnect) a new slot to a signal inside of a slot of the same signal, what happens? - are the slots called which where connected before the signal was called, - or is new slot be called this time, too, - or is the behaviour undefined?
I didn't find anything on this subject in the manuals. Even if the behaviour is undefined, that should be mentioned.
It is unspecified whether that slot will be called this time or not. The "Notes" sentence of the connect function is meant to convey this, but the wording is rather poor:
http://www.boost.org/doc/html/signalN.html#id2584315-bb Thanks. The next time I'll look harder...sorry.
I assume there doesn't happen something evil (like if you use old iterators of std::vector after appending something), it's just not defined if the slot is called this time?
Nothing evil. We're using "unspecified" here, meaning that we don't have to say when the slot is called and when it isn't, but it has to work. Internally, we use linked lists to be sure that no iterators are invalidated when a slot is inserted. Doug
participants (4)
-
Doug Gregor
-
Douglas Gregor
-
Jeff Flinn
-
Setzer, Sebastian (ext)