Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost::Serialization and MFC Doc/View architecture
From: Colin Caprani (cc.caprani_at_[hidden])
Date: 2011-07-04 14:35:44


On Mon, Jul 4, 2011 at 4:55 PM, Robert Ramey <ramey_at_[hidden]> wrote:

>
> My personal experience is that ignoring this will lead to grief down
> the road. I don't know what your load function does so I can't
> comment in particular case.
>
>
You're right! I've replicated the problem in a skeletal MFC application. All
default options used on creation in VS2010, SDI application, unicode off,
shared DLL.

I attach the following in case it helps:
1. MyTypes & MyType class definitions file
2. CBoostSerializationTestDoc files
3. BoostSerialize.h boost includes

MyTypes is just a collector of MyType, but is stored as an owned pointer in
the Doc class.

There are two problems that occur:

1. The assertion failure mentioned previously:
To replicate this, run the program save a file (first.bst) and save another
file (second.bst). Open first.bst, then open second.bst to get failure. This
problem is fixed by commenting out the CObject inheretence on the MyType and
MyTypes classes (the inheretence is legacy from MFC serialization used in
the original app).

2. A memory leak on exit when the Problem #1 assertion is fixed.
>From inspection of debug output window. Many 8 bytes, which I suspect as
m_Val's of MyType.

I suspect that I may be making a basic error, perhaps not though, and that's
why I'm following up.

Thanks for any help you can offer,

Colin








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