Boost logo

Boost Users :

Subject: Re: [Boost-users] Preventing iostreams from accessing freed memory
From: Adam Nielsen (a.nielsen_at_[hidden])
Date: 2011-03-13 22:16:24


> So is there any way I can prevent a filtering_stream from performing I/O in
> its destructor?

Just for the record I think I found a solution. If I create my own class
inheriting from filtering_stream and in its destructor call this->reset(), and
only create instances of this class instead, then it flushes/closes everything
on destruct (while all the streams are valid) instead of after it (when the
streams have been freed.)

So far this has stopped all the segfaults!

Cheers,
Adam.


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