6 Aug
2009
6 Aug
'09
3:22 p.m.
Accessing of the member variables will then cause a crash of the program. Any ideas on how to get around this problem of the object destructing but the handler function already called by the IO service thread?
You can find the solution the ASIO examples and tutorial: usually it's worth binding the handers to the shared_ptr of the object, so that the object's life time would be managed automatically, and no destruction would occur before all the handlers are done.