Connecting signals2::signal to another signals2::signal: trackable?

class A { boost::signals2::signal

On Thursday, August 2, 2012, Frank Mori Hess wrote:
It doesn't crash for me (I tried with the attached test program). Can you provide a test program that produces the crash?
Frank, Thank you for your reply. I did not run a test program; however, I do not understand how it could possibly be defined behavior. By what mechanism could the signal know that its slot has been destroyed and should not be used? I'll get back to you with a test program. Thanks, Chris

On Thu, Aug 2, 2012 at 7:29 PM, Frank Mori Hess
It doesn't crash for me (I tried with the attached test program). Can you provide a test program that produces the crash?
Frank, I updated your test program to by using signal::num_slots to test whether your no-crash was a fluke or whether it was really safe. It appears to be genuinely safe, although I do not understand how. If anyone knows, please chime in! Thank you, Chris

Excuse my ignorance, but what does connecting one signal to another mean? Is it chaining the signals? Where is it documented?

On Fri, Aug 3, 2012 at 10:06 AM, Igor R
Excuse my ignorance, but what does connecting one signal to another mean? Is it chaining the signals? Where is it documented?
Igor, You are correct, it is not documented. I assumed that it chains the signals. Using GDB, this is what happens (not that I understand any of it): 1. SignalA.connect(SignalB); 2. SignalB is passed as argument "f" to this function: template<typename F> BOOST_SIGNALS2_SLOT_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)(const F& f) { init_slot_function(f); } 3. Then SignalB is passed to: template<typename F> void init_slot_function(const F& f) { _slot_function = detail::get_invocable_slot(f, detail::tag_type(f)); signals2::detail::tracked_objects_visitor visitor(this); boost::visit_each(visitor, f); } === It appears that SignalB is converted to a slot. I don't know what tracked_objects_visitor is, but perhaps it is the magic that keeps the test program from crashing. Chris
participants (3)
-
Chris Stankevitz
-
Frank Mori Hess
-
Igor R