Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3650: Text Serialization crashes when istream close unexpectedly
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-12-01 14:25:59
#3650: Text Serialization crashes when istream close unexpectedly
--------------------------------------+-------------------------------------
Reporter: Doug Wallas | Owner: ramey
Type: Feature Requests | Status: closed
Milestone: Boost 1.42.0 | Component: serialization
Version: Boost Development Trunk | Severity: Problem
Resolution: wontfix | Keywords:
--------------------------------------+-------------------------------------
Comment(by anonymous):
Hello,
I understand your point but the library sigfaults on the >> operator... So
i think it's not possible for the user code to handle it :(
{{{
boost::archive::text_iarchive ia(*_stream);
do{
boost::shared_ptr<Message> msg;
ia >> msg; // sigfaults
if(_stream->fail()) // Wont be called
throw ...
}while(! _stream->eof()) {
}}}
Thanks for your time looking at the problem.
Replying to [comment:4 ramey]:
> The reason that I did it the way I did was to permit the user code to
handle the fail case. If I throw an exception after each operation, then
the user can't make code like
>
>
> {{{
> boost::archive::text_iarchive ia(*_stream);
> do{
> boost::shared_ptr<Message> msg;
> ia >> msg; ...
> }while(! _stream->eof() && ! _stream->fail() ) {
> }}}
>
> But would be obligated to write exception handling code. If you really
want things to operate this way, you can write
>
> {{{
> boost::archive::text_iarchive ia(*_stream);
> do{
> boost::shared_ptr<Message> msg;
> ia >> msg; ...
> if(_stream->fail())
> throw ...
> }while(! _stream->eof()) {
> }}}
>
> So the current situation leaves more flexibility to the user.
>
> Robert Ramey
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3650#comment:5> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC