diff --git a/include/boost/exception/detail/exception_ptr.hpp b/include/boost/exception/detail/exception_ptr.hpp index 21b35e3..53648f8 100644 --- a/include/boost/exception/detail/exception_ptr.hpp +++ b/include/boost/exception/detail/exception_ptr.hpp @@ -20,6 +20,7 @@ #include #endif #include +#include #include #include #include @@ -81,8 +82,9 @@ boost exception_ptr copy_exception( E const & e ) { - wrapexcept * w = new wrapexcept(e); - return exception_ptr(shared_ptr >(w)); + E cp = e; + exception_detail::copy_boost_exception(&cp, &e); + return exception_ptr(boost::make_shared >(cp)); } template diff --git a/test/copy_exception_test.cpp b/test/copy_exception_test.cpp index 69acb65..649ade2 100644 --- a/test/copy_exception_test.cpp +++ b/test/copy_exception_test.cpp @@ -110,7 +110,7 @@ void thread_test() { boost::thread_group grp; - for( int i=0; i!=50; ++i ) + for( int i=0; i!=100; ++i ) grp.create_thread(&consume); grp.join_all (); }