Boost logo

Boost :

From: Vahan Margaryan (vahan.margaryan_at_[hidden])
Date: 2002-06-29 03:03:26


Hello Robert,
After the previous release, I made a post concerning a typo in boarchive. In
this release, it is still there, and it still prevents the code from
compiling. The pure virtual function basic_oarchive::write_string(...) is
overriden with boarchive::write_Wstring(...), this naturally doesn't work.

I have also commented on the exception safety issues. In this release, you
have added a function delete_created_pointers, that's supposed to take care
of this issue. There are issues with it though:

1. The function crashes. In my test, I emit an exception from a loading
function. delete_created_pointers crashes because it attempts to delete a
pointer 0xCCCCCCCC. This value means uninitialized pointer under MSVC. The
code that causes this error in my case seems to be in function:

type_info_class_load<T>::load_object_ptr(basic_iarchive& ar, void*& x, ...)
{
  T * t;
  boost::serialization_detail::load_ptr_template(ar, t, version, 1L);
  x = t;
}

If load_ptr_template emits en exception (as it does), x remains
uninitialized, and it apparently is in the list of created objects. I
inserted an x= NULL statement before the load_ptr_template call, and it
didn't crash, but then I lost 1 object (the one being loaded), so it's not a
valid fix.

2. The function delete_created_pointers( ) doesn't provide a safe solution
anyway. The function deletes ALL the objects created during load. Some of
those objects have been loaded successfully and will be deleted by their
owners in the destructors. This will lead to double deletions. See my
previous post on this issue...

Regards,
-Vahan


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