]> granicus.if.org Git - postgis/commitdiff
Fix cache coherence error where the trees were being built on top of geometries which...
authorPaul Ramsey <pramsey@cleverelephant.ca>
Sat, 30 Jun 2012 21:18:06 +0000 (21:18 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Sat, 30 Jun 2012 21:18:06 +0000 (21:18 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@10005 b70326c6-7e19-0410-871a-916f4a2858ee

libpgcommon/lwgeom_cache.c

index cfdc85bffd3f175ee8fdf4b64352fc31fcdbcbff..9baa63283d3cabd05faed00d28f28c50b6b15d8b 100644 (file)
@@ -117,7 +117,8 @@ GetPROJ4SRSCache(FunctionCallInfoData* fcinfo)
 /**
 * Get an appropriate (based on the entry type number) 
 * GeomCache entry from the generic cache if one exists.
-* If it doesn't exist, make a new empty one and return it.
+* Returns a cache pointer if there is a cache hit and we have an
+* index built and ready to use. Returns NULL otherwise.
 */
 GeomCache*            
 GetGeomCache(FunctionCallInfoData* fcinfo, const GeomCacheMethods* cache_methods, const GSERIALIZED* g1, const GSERIALIZED* g2)
@@ -152,7 +153,7 @@ GetGeomCache(FunctionCallInfoData* fcinfo, const GeomCacheMethods* cache_methods
             memcmp(cache->geom1, g1, cache->geom1_size) == 0 )
        {
                cache_hit = 1;
-               geom = g1;
+               geom = cache->geom1;
 
        }
        /* Cache hit on second argument */
@@ -162,7 +163,7 @@ GetGeomCache(FunctionCallInfoData* fcinfo, const GeomCacheMethods* cache_methods
                  memcmp(cache->geom2, g2, cache->geom2_size) == 0 )
        {
                cache_hit = 2;
-               geom = g2;
+               geom = cache->geom2;
        }
        /* No cache hit. If we have a tree, free it. */
        else