[geos-devel] GeometryCollection interfaces

Martin Davis mbdavis at VividSolutions.com
Mon Oct 20 12:14:20 EDT 2003


Personally I felt that this was pretty much an issue for the programmer.  He needs to be aware that he is aliasing Geometrys when he's constructing them, and copy them as necessary.  I don't think this copying should be done internally by GEOS, since it can't know the usage pattern and so may make unecessary copies.

What are your ideas for coping with this?

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.
Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
Phone: (250) 385 6040    Fax: (250) 385 6046



> -----Original Message-----
> From: strk [mailto:strk at keybit.net]
> Sent: Sunday, October 19, 2003 3:49 AM
> To: geos-devel at geos.refractions.net
> Cc: pramsey at refractions.net
> Subject: [geos-devel] GeometryCollection interfaces
> 
> 
> When constructing geometry collections (Multi*, GeometryCollection)
> we will pass the constructors a vector to "component" geometries.
> The vector will be untouched while the pointed-to geometries will
> be taken on by created object. This means that you can NOT
> delete base geometries passed to geometry collection constructor.
> This also mean that you can not do something like:
> 
> PSEUDOCODE:
> 	1: point = createPoint;
> 	2: line = createLine;
> 	3: polygon = createPolygon;
> 	4: collection1 = createCollection(point, line);
> 	5: collection2 = createCollection(point, polygon);
> 	6: destroy collection1;
> 	7: destroy collection2;
> 
> This is because line 6 will destroy all collection1 components that
> is point and line. Line 7 will try to destroy components of 
> collection2
> which are point and polygon. Well: point will have been 
> already destroyed,
> segfault!
> 
> Needless to say you won't be able to use point, line, polygon 
> any further
> because you are left (after line 6) with pointer to "private" space!
> You have loaded weapons in your hands!
> 
> What do you think about this ? I have few proposal, but I'd 
> like to hear
> from you first.
> 
> --strk;
> 
> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net
> http://geos.refractions.net/mailman/listinfo/geos-devel
> 



More information about the geos-devel mailing list