From: Paul Ramsey Date: Sat, 30 Jun 2012 21:18:06 +0000 (+0000) Subject: Fix cache coherence error where the trees were being built on top of geometries which... X-Git-Tag: 2.1.0beta2~846 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1098023df17a86096afb0d5a853fac0a597fa39c;p=postgis Fix cache coherence error where the trees were being built on top of geometries which would get freed out from underneath them. Instead build them on the cached representations we're carrying around anyways (#1796) git-svn-id: http://svn.osgeo.org/postgis/trunk@10005 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/libpgcommon/lwgeom_cache.c b/libpgcommon/lwgeom_cache.c index cfdc85bff..9baa63283 100644 --- a/libpgcommon/lwgeom_cache.c +++ b/libpgcommon/lwgeom_cache.c @@ -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