Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-08-31 14:00:33


"Jeff Flinn" <TriumphSprint2000_at_[hidden]> wrote in message
news:ch22j5$qr8$1_at_sea.gmane.org...
> I've tried to replace a couple of existing derived stream/streambuf classes
> that are used with boost::serialization i/o archives to support
> Drag/Drop/Copy/Paste in an MFC application.
>
> The Drop/Paste side works great and significantly simplifies and reduces the
> amount of code req'd:

I glad to hear it.

> Unfortunately, the Drag/Copy side produces a access violation in the
> std::locale copy constructor, when
> boost::io::detail::indirect_streambuf::imbue calls
> std::basic_streambuf::pbuimbue. I've tried the following with both
> binary/text archive types:

At some point I accidentally erased the initialization of the pointer next_ in
the indirect_streambuf member initialization list. It should be patched as
follows:

----
diff -u -r1.5 indirect_streambuf.hpp
--- indirect_streambuf.hpp 31 Aug 2004 18:51:32 -0000 1.5
+++ indirect_streambuf.hpp 31 Aug 2004 18:51:41 -0000
@@ -142,7 +142,7 @@
 template<typename T, typename Tr, typename Alloc, typename Mode>
 indirect_streambuf<T, Tr, Alloc, Mode>::indirect_streambuf()
-    : pback_size_(0), flags_(0) { }
+    : next_(0), pback_size_(0), flags_(0) { }
----
Let me know if this works. I think this is a small enough change that I can fix
it without confusing reviewers. I'll try to to it later today.
> Am I doing anything obviously wrong?
No, I was ;-)
> I love the source/sink approach and
> would love to take advantage of it's conceptual simplification in dealing
> with streams.
Thanks!
Jonathan

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk