Opened 11 years ago

Closed 11 years ago

#2192 closed defect (fixed)

MgMultiGeometry::Deserialize doesn't work with MgAgfStream

Reported by: waltweltonlair Owned by: waltweltonlair
Priority: high Milestone: 2.5
Component: General Version: 2.4.0
Severity: major Keywords:
Cc: External ID: 1460281.01

Description

The following code currently fails:

    Ptr<MgMultiGeometry> geom = ...;

    MgAgfReaderWriter agfReaderWriter;
    Ptr<MgByteReader> reader = agfReaderWriter.Write(geom);
    Ptr<MgGeometry> multiGeometry = agfReaderWriter.Read(reader);

The MgAgfReaderWriter::Read call results in a call to MgMultiGeometry::Deserialize with an MgAgfStream, but Deserialize is not correctly handling this case.

Change History (2)

comment:1 by waltweltonlair, 11 years ago

External ID: 1460281.01
Status: newassigned

This is a regression introduced with changeset r3502 to fix ticket #788.

In that submission special code was added to get the geometry type via a peek operation. The peek operation was coded to work with MgStream, but it doesn't work with MgAgfStream.

MgStream inherits from MgStreamReader / MgStreamWriter, and the default implementations of the Get / Write methods in MgStreamReader / MgStreamWriter serialize stream header / version / data header fields. The peek operation added in r3502 was coded to handle this.

MgAgfStream inherits from MgStream and overrides the Get / Write methods. It does not serialize stream header / version / data header fields.

To fix this we simply need to enhance the code in MgMultiGeometry::Deserialize to check the type of the passed-in MgStream. If it's an MgAgfStream then we need to use the original pre-3502 code for doing the peek operation. If it's a pure MgStream then we use the code added in r3502.

comment:2 by waltweltonlair, 11 years ago

Resolution: fixed
Status: assignedclosed

Fixed in the trunk stream with changeset r7238.

Fixed in the 2.5k sandbox stream with changeset r7239.

Note: See TracTickets for help on using tickets.