[geos-devel] GeometryCollection interfaces

Norman Vine nhv at cape.com
Sun Oct 19 07:29:56 EDT 2003

strk writes:
> 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:
> 	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!

IMO we should be using something like
so these sorts of things are a non-issue



More information about the geos-devel mailing list