Fix double-free error that occurs when an exception is thrown from a

handler that has been dispatched (i.e. not posted) through a strand.
This commit is contained in:
chris_kohlhoff 2008-03-27 14:16:36 +00:00
parent 363e00a889
commit 43c99e6a6d

View File

@ -427,10 +427,9 @@ public:
if (impl->current_handler_ == 0)
{
// This handler now has the lock, so can be dispatched immediately.
impl->current_handler_ = ptr.get();
impl->current_handler_ = ptr.release();
lock.unlock();
this->get_io_service().dispatch(invoke_current_handler(*this, impl));
ptr.release();
}
else
{
@ -467,10 +466,9 @@ public:
if (impl->current_handler_ == 0)
{
// This handler now has the lock, so can be dispatched immediately.
impl->current_handler_ = ptr.get();
impl->current_handler_ = ptr.release();
lock.unlock();
this->get_io_service().post(invoke_current_handler(*this, impl));
ptr.release();
}
else
{