Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54820 - trunk/boost/serialization
From: ramey_at_[hidden]
Date: 2009-07-08 18:53:23


Author: ramey
Date: 2009-07-08 18:53:22 EDT (Wed, 08 Jul 2009)
New Revision: 54820
URL: http://svn.boost.org/trac/boost/changeset/54820

Log:
Fix invalid pointer in unregister cast in void_cast.cpp
Text files modified:
   trunk/boost/serialization/extended_type_info.hpp | 1 +
   trunk/boost/serialization/extended_type_info_no_rtti.hpp | 8 ++++++++
   trunk/boost/serialization/extended_type_info_typeid.hpp | 5 +++++
   trunk/boost/serialization/singleton.hpp | 3 +++
   trunk/boost/serialization/void_cast.hpp | 7 +++++++
   5 files changed, 24 insertions(+), 0 deletions(-)

Modified: trunk/boost/serialization/extended_type_info.hpp
==============================================================================
--- trunk/boost/serialization/extended_type_info.hpp (original)
+++ trunk/boost/serialization/extended_type_info.hpp 2009-07-08 18:53:22 EDT (Wed, 08 Jul 2009)
@@ -76,6 +76,7 @@
     virtual void destroy(void const * const /*p*/) const {
         assert(false); // must be implemented if used
     }
+ virtual bool & get_is_destroyed() const = 0;
 };
 
 } // namespace serialization

Modified: trunk/boost/serialization/extended_type_info_no_rtti.hpp
==============================================================================
--- trunk/boost/serialization/extended_type_info_no_rtti.hpp (original)
+++ trunk/boost/serialization/extended_type_info_no_rtti.hpp 2009-07-08 18:53:22 EDT (Wed, 08 Jul 2009)
@@ -62,7 +62,15 @@
     public detail::extended_type_info_no_rtti_0,
     public singleton<extended_type_info_no_rtti<T> >
 {
+ bool & get_is_destroyed() const{
+ return singleton<
+ extended_type_info_no_rtti<T>
+ >::get_is_destroyed();
+ }
 public:
+ extended_type_info_no_rtti() :
+ detail::extended_type_info_no_rtti_0()
+ {}
     const extended_type_info *
     get_derived_extended_type_info(const T & t) const {
         // find the type that corresponds to the most derived type.

Modified: trunk/boost/serialization/extended_type_info_typeid.hpp
==============================================================================
--- trunk/boost/serialization/extended_type_info_typeid.hpp (original)
+++ trunk/boost/serialization/extended_type_info_typeid.hpp 2009-07-08 18:53:22 EDT (Wed, 08 Jul 2009)
@@ -70,6 +70,11 @@
     public detail::extended_type_info_typeid_0,
     public singleton<extended_type_info_typeid<T> >
 {
+ virtual bool & get_is_destroyed() const {
+ return singleton<
+ extended_type_info_typeid<T>
+ >::get_is_destroyed();
+ }
 public:
     extended_type_info_typeid() :
         detail::extended_type_info_typeid_0()

Modified: trunk/boost/serialization/singleton.hpp
==============================================================================
--- trunk/boost/serialization/singleton.hpp (original)
+++ trunk/boost/serialization/singleton.hpp 2009-07-08 18:53:22 EDT (Wed, 08 Jul 2009)
@@ -136,6 +136,9 @@
     BOOST_DLLEXPORT static bool is_destroyed(){
         return detail::singleton_wrapper<T>::m_is_destroyed;
     }
+ BOOST_DLLEXPORT static bool & get_is_destroyed(){
+ return detail::singleton_wrapper<T>::m_is_destroyed;
+ }
 };
 
 template<class T>

Modified: trunk/boost/serialization/void_cast.hpp
==============================================================================
--- trunk/boost/serialization/void_cast.hpp (original)
+++ trunk/boost/serialization/void_cast.hpp 2009-07-08 18:53:22 EDT (Wed, 08 Jul 2009)
@@ -109,6 +109,9 @@
     // Data members
     const extended_type_info * m_derived;
     const extended_type_info * m_base;
+ bool & m_derived_is_destroyed;
+ bool & m_base_is_destroyed;
+
     /*const*/ std::ptrdiff_t m_difference;
     virtual bool is_shortcut() const {
         return false;
@@ -143,11 +146,15 @@
     ) :
         m_derived(derived),
         m_base(base),
+ m_derived_is_destroyed(derived->get_is_destroyed()),
+ m_base_is_destroyed(base->get_is_destroyed()),
         m_difference(difference)
     {}
     void_caster(const void_caster & rhs) :
         m_derived(rhs.m_derived),
         m_base(rhs.m_base),
+ m_derived_is_destroyed(rhs.m_derived_is_destroyed),
+ m_base_is_destroyed(rhs.m_base_is_destroyed),
         m_difference(rhs.m_difference)
     {}
     virtual ~void_caster(){}


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