From: Matthew Leotta <Matthew_Leotta@br...> - 2004-05-27 19:55:05
There seems to be a bug in vbl_io_smart_ptr.txx. The serialization
does not work properly if multiple NULL smart pointers are read.
vbl_io_smart_ptr does not handle this case separately and therefore
assigns a serial number to NULL. Writing succeeds under these
conditions. However, is.get_serialisation_pointer returns a NULL
pointer if an object has not yet been loaded. This is ambiguous in the
case where you are actually reading a NULL pointer. Thus, the following
if (first_time != (pointer == 0))
// This checks that the saving stream and reading stream
// both agree on whether or not this is the first time they
// have seen this object.
vcl_cerr << "I/O ERROR: vsl_b_read(vsl_b_istream&, vbl_smart_ptr<T>&)\n"
<< " De-serialisation failure\n";
is.is().clear(vcl_ios::badbit); // Set an unrecoverable IO error on stream
It seems that if this check is removed and the following conditional
statement 'if(pointer == 0)' (line 121) is replaced with
'if(first_time)' then everything works fine.
Another solution is to modify get_serialisation_pointer so that it
returns a boolean and also returns the pointer by reference. This
solution involves more changes but is probably a better way to fix
Has anyone else had this problem or am I missing something? Is it safe
to make one of these changes (probably the second one)? I don't think
either will break existing binary files.
Get latest updates about Open Source Projects, Conferences and News.