diff --git a/doc/boost_exception_get_error_info_hpp.html b/doc/boost_exception_get_error_info_hpp.html
index 1850ab8..55fe7ca 100644
--- a/doc/boost_exception_get_error_info_hpp.html
+++ b/doc/boost_exception_get_error_info_hpp.html
@@ -28,10 +28,10 @@ namespace
boost
{
template <class ErrorInfo,class E>
- typename ErrorInfo::error_info::value_type const * get_error_info( E const & x );
+ typename ErrorInfo::error_info::value_type const * get_error_info( E const & x );
template <class ErrorInfo,class E>
- typename ErrorInfo::error_info::value_type * get_error_info( E & x );
+ typename ErrorInfo::error_info::value_type * get_error_info( E & x );
}
Requirements:
- ErrorInfo must be an instance of the error_info template.
diff --git a/include/boost/exception/detail/exception_ptr.hpp b/include/boost/exception/detail/exception_ptr.hpp
index 59686e9..0510fe2 100644
--- a/include/boost/exception/detail/exception_ptr.hpp
+++ b/include/boost/exception/detail/exception_ptr.hpp
@@ -73,12 +73,14 @@ boost
exception_ptr
get_bad_alloc()
{
- static exception_ptr e = boost::copy_exception(
- bad_alloc_() <<
- throw_function("boost::current_exception()") <<
+ bad_alloc_ ba;
+ exception_detail::clone_impl c(ba);
+ c <<
+ throw_function(BOOST_CURRENT_FUNCTION) <<
throw_file(__FILE__) <<
- throw_line(__LINE__) );
- return e;
+ throw_line(__LINE__);
+ static exception_ptr ep(new exception_detail::clone_impl(c));
+ return ep;
}
template
diff --git a/include/boost/exception/exception.hpp b/include/boost/exception/exception.hpp
index fd516dd..adaac68 100644
--- a/include/boost/exception/exception.hpp
+++ b/include/boost/exception/exception.hpp
@@ -75,8 +75,8 @@ boost
void
release()
{
- if( px_ )
- px_->release();
+ if( px_ && px_->release() )
+ px_=0;
}
};
}
@@ -134,7 +134,7 @@ boost
class exception;
- template
+ template
class shared_ptr;
namespace
@@ -150,7 +150,7 @@ boost
virtual shared_ptr get( type_info_ const & ) const = 0;
virtual void set( shared_ptr const &, type_info_ const & ) = 0;
virtual void add_ref() const = 0;
- virtual void release() const = 0;
+ virtual bool release() const = 0;
virtual refcount_ptr clone() const = 0;
protected:
diff --git a/include/boost/exception/info.hpp b/include/boost/exception/info.hpp
index 7aeeee5..c918dbd 100644
--- a/include/boost/exception/info.hpp
+++ b/include/boost/exception/info.hpp
@@ -114,8 +114,8 @@ boost
tmp << header;
for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i )
{
- shared_ptr const & x = i->second;
- tmp << '[' << x->tag_typeid_name() << "] = " << x->value_as_string() << '\n';
+ error_info_base const & x = *i->second;
+ tmp << '[' << x.tag_typeid_name() << "] = " << x.value_as_string() << '\n';
}
tmp.str().swap(diagnostic_info_str_);
}
@@ -140,11 +140,16 @@ boost
++count_;
}
- void
+ bool
release() const
{
- if( !--count_ )
+ if( --count_ )
+ return false;
+ else
+ {
delete this;
+ return true;
+ }
}
refcount_ptr
diff --git a/include/boost/throw_exception.hpp b/include/boost/throw_exception.hpp
index 1d018c5..a384054 100644
--- a/include/boost/throw_exception.hpp
+++ b/include/boost/throw_exception.hpp
@@ -43,26 +43,6 @@
namespace boost
{
-#if !defined( BOOST_EXCEPTION_DISABLE )
- namespace
- exception_detail
- {
- template
- void
- throw_exception_( E const & x, char const * current_function, char const * file, int line )
- {
- throw_exception(
- set_info(
- set_info(
- set_info(
- enable_error_info(x),
- throw_function(current_function)),
- throw_file(file)),
- throw_line(line)));
- }
- }
-#endif
-
#ifdef BOOST_NO_EXCEPTIONS
void throw_exception( std::exception const & e ); // user defined
@@ -86,6 +66,26 @@ template BOOST_ATTRIBUTE_NORETURN inline void throw_exception( E const
#endif
+#if !defined( BOOST_EXCEPTION_DISABLE )
+ namespace
+ exception_detail
+ {
+ template
+ BOOST_ATTRIBUTE_NORETURN
+ void
+ throw_exception_( E const & x, char const * current_function, char const * file, int line )
+ {
+ boost::throw_exception(
+ set_info(
+ set_info(
+ set_info(
+ enable_error_info(x),
+ throw_function(current_function)),
+ throw_file(file)),
+ throw_line(line)));
+ }
+ }
+#endif
} // namespace boost
#endif // #ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED
diff --git a/test/no_exceptions_test.cpp b/test/no_exceptions_test.cpp
index bbabcfc..2609be6 100644
--- a/test/no_exceptions_test.cpp
+++ b/test/no_exceptions_test.cpp
@@ -9,6 +9,7 @@
#include
#include
#include
+#include
struct
my_exception:
@@ -38,6 +39,7 @@ boost
#ifndef BOOST_NO_RTTI
BOOST_TEST(s.find("my_tag")!=std::string::npos);
#endif
+ exit(0);
}
}
diff --git a/test/refcount_ptr_test.cpp b/test/refcount_ptr_test.cpp
index 773d784..283f570 100644
--- a/test/refcount_ptr_test.cpp
+++ b/test/refcount_ptr_test.cpp
@@ -28,11 +28,16 @@ test_type
++count_;
}
- void
+ bool
release()
{
- if( !--count_ )
+ if( --count_ )
+ return false;
+ else
+ {
delete this;
+ return true;
+ }
}
private: