|
Boost : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2004-03-05 17:37:31
Jeff Flinn wrote:
>My app is hitting the assertion at line 133 in basic_text_oarchive.hpp with
>delimiter = 3 when serializing to a text_oarchive. The assertion occurs
>during serialization of the count for a shared_ptr. There is an access
>violation when attempting to serialize to a binary_oarchive also. XML
>serialization in both directions works fine. The odd thing is, if I comment
>out any usage of xml_oarchive, the assertion is not triggered, and
>serialization to both text_oarchive and binary_oarchive succeeds. Input
>from binary/text/xml succeeds in all cases.
This has been reported recently and addressed in the next version. In the
case I know about it occurred with an instance of a derived class serialized
though a polymorphic base class pointer which was previously neither
"registered" or "exported". This has been addressed by throwing of an
exception at an earlier point.
This also occurred when using serialization of a derived polymorphic shared
pointer though its base class.
This sounds like your case.
An updated copy of test_shared_ptr shows how this can be addressed. (I'll
send you the latest copy) It turns out that my implementation of
serialization of shared pointer isn't quite there. It needs a more elegant
way to automatically register/export shared_count<P, D> when P is the
derived class and we're serializing through a base class pointer. I havn't
thought about this because:
a) I'm really reluctant to get involved with shared_ptr
b) I think other issues will also come up - e.g. exception safety while
serialization of shared pointer
c) locking during multi-threading
d) ?
Robert Ramey
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk