Boost logo

Boost-Commit :

From: chris_at_[hidden]
Date: 2008-05-31 21:31:25


Author: chris_kohlhoff
Date: 2008-05-31 21:31:25 EDT (Sat, 31 May 2008)
New Revision: 46003
URL: http://svn.boost.org/trac/boost/changeset/46003

Log:
Add test for the crash that can occur when destroying a handler object that
owns its own memory (as is the case when destroying handlers in an orphaned
strand).

Text files modified:
   trunk/libs/asio/test/strand.cpp | 15 +++++++++++++++
   1 files changed, 15 insertions(+), 0 deletions(-)

Modified: trunk/libs/asio/test/strand.cpp
==============================================================================
--- trunk/libs/asio/test/strand.cpp (original)
+++ trunk/libs/asio/test/strand.cpp 2008-05-31 21:31:25 EDT (Sat, 31 May 2008)
@@ -161,6 +161,21 @@
   // The run() calls will not return until all work has finished.
   BOOST_CHECK(count == 3);
   BOOST_CHECK(exception_count == 2);
+
+ count = 0;
+ ios.reset();
+
+ // Check for clean shutdown when handlers posted through an orphaned strand
+ // are abandoned.
+ {
+ strand s2(ios);
+ s2.post(boost::bind(increment, &count));
+ s2.post(boost::bind(increment, &count));
+ s2.post(boost::bind(increment, &count));
+ }
+
+ // No handlers can be called until run() is called.
+ BOOST_CHECK(count == 0);
 }
 
 test_suite* init_unit_test_suite(int, char*[])


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