|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r61602 - in trunk: boost/exception libs/exception/test
From: emil_at_[hidden]
Date: 2010-04-26 21:14:04
Author: emildotchevski
Date: 2010-04-26 21:14:03 EDT (Mon, 26 Apr 2010)
New Revision: 61602
URL: http://svn.boost.org/trac/boost/changeset/61602
Log:
workaround for double-destruction bugs in compilers: with this, boost::exception objects should survive the case when the destructor is called twice.
Text files modified:
trunk/boost/exception/exception.hpp | 6 +++---
trunk/boost/exception/info.hpp | 9 +++++++--
trunk/libs/exception/test/refcount_ptr_test.cpp | 9 +++++++--
3 files changed, 17 insertions(+), 7 deletions(-)
Modified: trunk/boost/exception/exception.hpp
==============================================================================
--- trunk/boost/exception/exception.hpp (original)
+++ trunk/boost/exception/exception.hpp 2010-04-26 21:14:03 EDT (Mon, 26 Apr 2010)
@@ -75,8 +75,8 @@
void
release()
{
- if( px_ )
- px_->release();
+ if( px_ && px_->release() )
+ px_=0;
}
};
}
@@ -150,7 +150,7 @@
virtual shared_ptr<error_info_base> get( type_info_ const & ) const = 0;
virtual void set( shared_ptr<error_info_base> const &, type_info_ const & ) = 0;
virtual void add_ref() const = 0;
- virtual void release() const = 0;
+ virtual bool release() const = 0;
virtual refcount_ptr<exception_detail::error_info_container> clone() const = 0;
protected:
Modified: trunk/boost/exception/info.hpp
==============================================================================
--- trunk/boost/exception/info.hpp (original)
+++ trunk/boost/exception/info.hpp 2010-04-26 21:14:03 EDT (Mon, 26 Apr 2010)
@@ -140,11 +140,16 @@
++count_;
}
- void
+ bool
release() const
{
- if( !--count_ )
+ if( --count_ )
+ return false;
+ else
+ {
delete this;
+ return true;
+ }
}
refcount_ptr<error_info_container>
Modified: trunk/libs/exception/test/refcount_ptr_test.cpp
==============================================================================
--- trunk/libs/exception/test/refcount_ptr_test.cpp (original)
+++ trunk/libs/exception/test/refcount_ptr_test.cpp 2010-04-26 21:14:03 EDT (Mon, 26 Apr 2010)
@@ -28,11 +28,16 @@
++count_;
}
- void
+ bool
release()
{
- if( !--count_ )
+ if( --count_ )
+ return false;
+ else
+ {
delete this;
+ return true;
+ }
}
private:
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