[geos-commits] r3317 - trunk/src/geom

svn_geos at osgeo.org svn_geos at osgeo.org
Thu Apr 28 11:08:47 EDT 2011


Author: strk
Date: 2011-04-28 08:08:47 -0700 (Thu, 28 Apr 2011)
New Revision: 3317

Modified:
   trunk/src/geom/Geometry.cpp
Log:
Do not leak on exception during relational geometry predicates

Modified: trunk/src/geom/Geometry.cpp
===================================================================
--- trunk/src/geom/Geometry.cpp	2011-04-28 14:16:56 UTC (rev 3316)
+++ trunk/src/geom/Geometry.cpp	2011-04-28 15:08:47 UTC (rev 3317)
@@ -305,9 +305,8 @@
 	if (! getEnvelopeInternal()->intersects(g->getEnvelopeInternal()))
 		return true;
 #endif
-	IntersectionMatrix *im=relate(g);
+	auto_ptr<IntersectionMatrix> im ( relate(g) );
 	bool res=im->isDisjoint();
-	delete im;
 	return res;
 }
 
@@ -319,9 +318,8 @@
 	if (! getEnvelopeInternal()->intersects(g->getEnvelopeInternal()))
 		return false;
 #endif
-	IntersectionMatrix *im=relate(g);
+	auto_ptr<IntersectionMatrix> im ( relate(g) );
 	bool res=im->isTouches(getDimension(), g->getDimension());
-	delete im;
 	return res;
 }
 
@@ -360,9 +358,8 @@
 		return predicate::RectangleIntersects::intersects(*p, *this);
 	}
 
-	IntersectionMatrix *im=relate(g);
+	auto_ptr<IntersectionMatrix> im ( relate(g) );
 	bool res=im->isIntersects();
-	delete im;
 	return res;
 }
 
@@ -396,9 +393,8 @@
 	if (! getEnvelopeInternal()->intersects(g->getEnvelopeInternal()))
 		return false;
 #endif
-	IntersectionMatrix *im=relate(g);
+	auto_ptr<IntersectionMatrix> im ( relate(g) );
 	bool res=im->isCrosses(getDimension(), g->getDimension());
-	delete im;
 	return res;
 }
 
@@ -427,9 +423,8 @@
 	//	return predicate::RectangleContains::contains((const Polygon&)*g, *this);
 	//}
 
-	IntersectionMatrix *im=relate(g);
+	auto_ptr<IntersectionMatrix> im ( relate(g) );
 	bool res=im->isContains();
-	delete im;
 	return res;
 }
 
@@ -441,18 +436,16 @@
 	if (! getEnvelopeInternal()->intersects(g->getEnvelopeInternal()))
 		return false;
 #endif
-	IntersectionMatrix *im=relate(g);
+	auto_ptr<IntersectionMatrix> im ( relate(g) );
 	bool res=im->isOverlaps(getDimension(), g->getDimension());
-	delete im;
 	return res;
 }
 
 bool
 Geometry::relate(const Geometry *g, const string &intersectionPattern) const
 {
-	IntersectionMatrix *im=relate(g);
+	auto_ptr<IntersectionMatrix> im ( relate(g) );
 	bool res=im->matches(intersectionPattern);
-	delete im;
 	return res;
 }
 
@@ -464,9 +457,8 @@
 	if (! getEnvelopeInternal()->equals(g->getEnvelopeInternal()))
 		return false;
 #endif
-	IntersectionMatrix *im=relate(g);
+	auto_ptr<IntersectionMatrix> im ( relate(g) );
 	bool res=im->isEquals(getDimension(), g->getDimension());
-	delete im;
 	return res;
 }
 



More information about the geos-commits mailing list