[geos-devel] GeometryCollection interfaces

strk strk at keybit.net
Sun Oct 19 06:48:42 EDT 2003


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;



More information about the geos-devel mailing list