Boost logo

Boost :

From: Bruno Martínez (br1_at_[hidden])
Date: 2006-07-13 14:14:38


Hello.

Investigating a problem Elisabeth Benoit was having at the users mailing
list I've come to this code, that doesn't work as I would expect:

#include <boost/signal.hpp>
#include <iostream>

void func()
{
     std::cout << "pp\n";
}

int main()
{
     boost::signal0<void> signal1;
     boost::signal0<void> signal2;
     boost::signal0<void>::slot_type slot = &func;
     boost::signals::connection conn = signal1.connect(slot);
     signal2.connect(slot);
     conn.disconnect();
     signal2();
}

The func() free function is only called once, because disconnect() removes
the slot from both signals.

I'm not sure if this is a bug, but I would expect slot_type to work as
boost::function.

Regards,
Bruno


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk