Opened 12 years ago

Closed 12 years ago

#4373 closed Bugs (invalid)

object tracking not working when pointer is serialized before class member

Reported by: anonymous Owned by: Robert Ramey
Milestone: Boost 1.44.0 Component: serialization
Version: Boost 1.44.0 Severity: Problem
Keywords: Cc:

Description

I'm not sure if this is a bug or a limitation of Boost.Serialization. I haven't found anything in the documentation saying that this limitation exists though. it's certainly unexpected if you don't think about serilization internals:

struct B{

Serializable

};

struct A{

B *bptr;

B b;

template<class Archive>

void serialize(Archive &ar,unsigned int){

ar & bptr; error

ar & b;

}

};

if bptr is pointing to b, the object can not be loaded correctly. I'm not sure what actually happens, I guess there is a duplicate created, but bptr isnt equal to &b after serialization, as it was before serialization.

b must be serialized before bptr for this to work.

testcase attached.

Attachments (1)

testcase.cpp (930 bytes ) - added by anonymous 12 years ago.

Download all attachments as: .zip

Change History (3)

by anonymous, 12 years ago

Attachment: testcase.cpp added

comment:1 by anonymous, 12 years ago

test

comment:2 by anonymous, 12 years ago

Resolution: invalid
Status: newclosed

my mistake. archive_exception is thrown on serialization.

Note: See TracTickets for help on using tickets.