Boost logo

Boost-Commit :

From: chris_at_[hidden]
Date: 2008-03-27 10:18:07


Author: chris_kohlhoff
Date: 2008-03-27 10:18:07 EDT (Thu, 27 Mar 2008)
New Revision: 43879
URL: http://svn.boost.org/trac/boost/changeset/43879

Log:
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.

Text files modified:
   trunk/boost/asio/detail/strand_service.hpp | 6 ++----
   1 files changed, 2 insertions(+), 4 deletions(-)

Modified: trunk/boost/asio/detail/strand_service.hpp
==============================================================================
--- trunk/boost/asio/detail/strand_service.hpp (original)
+++ trunk/boost/asio/detail/strand_service.hpp 2008-03-27 10:18:07 EDT (Thu, 27 Mar 2008)
@@ -428,10 +428,9 @@
       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
       {
@@ -468,10 +467,9 @@
     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
     {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk