Boost logo

Boost Users :

From: Hugh Hoover (hugh_at_[hidden])
Date: 2007-10-27 18:36:53


I have a curious problem that's just sprung up, after changing from
using plain-old-pointers to using boost::shared_ptrs internally in my
data structures (stl hash_map and map)
The problem is that while the XML archive works correctly, both text
and binary fail (they all used to work).

This is using gcc 4.0.1 on darwin and VC8 on windows, boost version is
1.34.1

The failure occurs while unserializing an archive, specifically when
trying to read back a shared_ptr to an already unserialized object.
In the archive, it shows the object (pointer) as an object_reference
(the same reference id in XML and text). While the XML version reads
the pointer back correctly, the text version fails and returns NULL.
I have not determined the exact reason why the text version fails (it
doesn't throw, just returns NULL). The serialization does not appear
to have any problems.

Since my actual code is reasonably complicated, and I haven't created
a simplified version that demonstrates the problem, I'm not including
code now - I'd just like to find out if this sounds familiar to
anyone, that is, working under XML but failing under text and binary.
It does appear to be shared_ptr specific, too, since everything was
working before replacing naked pointers with shared_ptrs.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net