Boost logo

Boost Users :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-08-14 09:34:04

"Robert Ramey" <ramey_at_[hidden]> wrote in message
> Hmm - this would surprise me. It looks to me that maybe I'm missing
> something about clean up from exceptions. baybe the std::ifstream lIn(
> lpszPathName ); should be moved outside the try block. I wouldn't think
> that should be necessary but now that I look at this it might be. What
> happens when you do this? Any C++ expert want to opine on this?

I took a quick look at the source for xml_iarchive.

It happens that you use the Pimpl-idiom without
using a smart pointer.

Remember the destructor is only called if the constructor
succeeds. This means that when you throw in the constructor
you never execute "delete pimpl" in the destructor.

I suggest that you use boost::scoped_ptr for all your pimpl

best regards


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at