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
news:ddiks0$mle$1_at_sea.gmane.org...
> 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
classes.

best regards

Thorsten


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