The connect
function takes a boost::function
object, which is basically a generic wrapper around anything that has an operator()
defined for it. Therefore it is exactly as safe as what you are binding.
For example, this is reasonably safe:
boost::shared_ptr<ClassName> pValue = boost::make_shared<ClassName>(...);
signal.connect(boost::bind(&ClassName::FuncName, pValue, ...);
This is reasonably safe because it stores a boost::shared_ptr
as part of its data.
ClassName *pValue = new ClassName(...);
signal.connect(boost::bind(&ClassName::FuncName, pValue, ...);
This is conditionally safe. It instantly becomes unsafe if that connection still exists and you execute delete pValue
.
Personally, I don't put much faith in "conditionally safe", but that's up to you. The point being that everything you bind to boost::bind
must continue to exist so long as it is bound.