
Hi all, I'm unable to prevent Boost iostreams from accessing memory once it has been freed, and I'm hoping someone here familiar with iostreams has some advice. As far as I can tell, when I push a standard iostream onto a filter, the filter holds on to a reference of it. If this happens inside a function, then when the function returns the iostream is freed, followed by the filter. In its destructor the filter tries to perform a flush/close and promptly segfaults, as it is trying to access the iostream which has just been freed. There is a set_auto_close() function I can call on the filter which sounds like it would do the trick, but it doesn't and according to the docs it's because it "does not prevent the Filters and Devices in the chain from being closed [flushed] automatically if the chain is complete at destruction." So is there any way I can prevent a filtering_stream from performing I/O in its destructor? Thanks, Adam.