The only functions I'm binding with boost::bind are members of ClassifierContext, eg:
Sean McAllister wrote:If you use patterns like
> Not using a shared_ptr_from_this, but I am using shared_ptr wrapped
> objects as parameters to my asynchronous callbacks...
>
boost::bind( &some_class::some_mem_fn, this, .... )
then it could be that the instance of some_class is destructed before the
bind-expression is. If the handler is called with "operation cancelled"
(which should happen with all waiting handlers if you call
io_service.stop()), it tries to make a call into freed memory -- you can
expect a crash, indeed. To solve this, one can use shared_from_this(),
boost::bind( &some_class::some_mem_fn, shared_from_this(), .... )
to make sure the object's lifetime will be at least that of the incomplete
handler.
Cheers,
Rutger
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users