
Bugs item #1262084, was opened at 2005-08-17 06:31 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1262084&group_id=7586 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: serialization Group: None Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Robert Ramey (ramey) Summary: crash deserializing 1.32 data (poly archive + stl container) Initial Comment: Hello, i got a problem deserializing STL containers with polymorphic archive interfaces. Serialization/Deserialization with boost 1.32 works fine. Simple object trees with stl containers (maps) and base class registration (no shared_ptr used). When i deserialize the data (xml) with boost 1.33 it asserts/crashes in basic_iarchive.cpp ( basic_iarchive_impl::reset_object_address): --- snip ---- inline void basic_iarchive_impl::reset_object_address( const void * new_address, const void *old_address ){ // if the this object wasn't tracked std::size_t i = moveable_object_position; if(i >= moveable_object_stack.size()) return; if(old_address != object_id_vector[i].address) // skip to any lower level ones ++i; while(i < moveable_object_stack.size()){ // calculate displacement from this level assert(object_id_vector[i].address >= old_address); <---- assert here !!! // warning - pointer arithmetic on void * is in herently non-portable // but expected to work on all platforms in current usage std::size_t member_displacement = reinterpret_cast<std::size_t>(object_id_vector[i].address) - reinterpret_cast<std::size_t>(old_address); ---- snip ---- Callstack:
::reset_object_address(const void * new_address=0x00fb67cc, const void *
ddc.exe!boost::archive::detail::basic_iarchive_impl::reset_object_address(const void * new_address=0x00fb67cc, const void * old_address=0x0135c67c) Line 266 + 0x2a C++ ddc.exe!boost::archive::detail::basic_iarchive::reset_object_address(const void * new_address=0x00fb67cc, const void * old_address=0x0135c67c) Line 530 C++ ddc.exe!boost::archive::detail::polymorphic_iarchive_impl<boost::archive::xml_iarchive_impl<boost::archive::xml_iarchive> old_address=0x0135c67c) Line 78 C++ ddc.exe!boost::serialization::stl::archive_input_map<boost::archive::polymorphic_iarchive,std::map<unsigned int,xxx::LayoutObject *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,xxx::LayoutObject *> > >
::operator()(boost::archive::polymorphic_iarchive & ar={...}, std::map<unsigned int,xxx::LayoutObject *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,xxx::LayoutObject *> > > & s={...}) Line 118 + 0x1a C++
ddc.exe!boost::serialization::stl::rebuild_collection<boost::archive::polymorphic_iarchive,std::map<unsigned int,xxx::LayoutObject *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,xxx::LayoutObject *> >
,boost::serialization::stl::archive_input_map<boost::archive::polymorphic_iarchive,std::map<unsigned int,xxx::LayoutObject *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,xxx::LayoutObject *> > > ,boost::serialization::stl::no_reserve_imp<std::map<unsigned int,xxx::LayoutObject *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,minimon::base::display::dispman::CLayoutObject *> > >
(boost::archive::polymorphic_iarchive & ar={...}, std::map<unsigned int,xxx::LayoutObject *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,xxx::LayoutObject *> > > & s={...}) Line 209 C++
ddc.exe!boost::serialization::stl::load_collection<boost::archive::polymorphic_iarchive,std::map<unsigned int,xxx::LayoutObject *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,xxx::LayoutObject *> >
,boost::serialization::stl::archive_input_map<boost::archive::polymorphic_iarchive,std::map<unsigned int,xxx::LayoutObject *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,xxx::LayoutObject *> > > ,boost::serialization::stl::no_reserve_imp<std::map<unsigned int,xxx::LayoutObject *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,xxx::LayoutObject *> > > > (boost::archive::polymorphic_iarchive & ar={...}, std::map<unsigned int,xxx::LayoutObject *,std::less<unsigned int>,std::allocator<std::pair<unsigned int const ,xxx::LayoutObject *> > > & s={...}) Line 230 + 0xd C++
---- The serializing code is implemented using split members and manual registration and usually read like this: ---- snip --- void DerivedLayoutObject::serialize( boost::archive::polymorphic_oarchive& ar, const unsigned int /* version */) { // register pointer type info ar.register_type(static_cast<LayoutObject*>(0)); // serialize data members ar & boost::serialization::make_nvp( "status", m_status); .... // serialize stl container (std::map here) ar & boost::serialization::make_nvp( "childs", m_childs); } (deserialization vise-versa) --------------------- Whats the problem here? I simply rebuilt the whole project using 1.33. Regards, A. Focht ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1262084&group_id=7586 ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ Boost-bugs mailing list Boost-bugs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/boost-bugs