Boost logo

Boost :

From: Doug Gregor (dgregor_at_[hidden])
Date: 2008-07-28 14:56:24


Somewhere between Boost 1.35.0 and 1.36.0, Boost.Serialization lost
the ability to (de-)serialize a pointer to a class with a protected or
private destructor. The problem is in
extended_type_info_typeid::destroy, which tries to delete a pointer
directly rather than using boost::serialization::access::destroy. This
is unfortunate, because it's breaking a use of the serialization
library in VTK.

The patch below fixes the problem and passes all regression tests.
Okay to commit to trunk and the 1.36.0 branch?

        - Doug

Index: extended_type_info_typeid.hpp
===================================================================
--- extended_type_info_typeid.hpp (revision 47849)
+++ extended_type_info_typeid.hpp (working copy)
@@ -28,6 +28,7 @@
  #include <boost/type_traits/is_polymorphic.hpp>
  #include <boost/type_traits/remove_const.hpp>

+#include <boost/serialization/access.hpp>
  #include <boost/serialization/singleton.hpp>
  #include <boost/serialization/extended_type_info.hpp>
  #include <boost/serialization/factory.hpp>
@@ -113,7 +114,7 @@ public:
          }
      }
      void destroy(void const * const p) const{
- delete static_cast<T const *>(p) ;
+ boost::serialization::access::destroy(static_cast<T const
*>(p));
      }
  };


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk