[postgis-commits] svn - r2655 - trunk/lwgeom
postgis-commits at postgis.refractions.net
postgis-commits at postgis.refractions.net
Thu Jul 12 13:33:23 PDT 2007
Author: mcayland
Date: 2007-07-12 13:33:23 -0700 (Thu, 12 Jul 2007)
New Revision: 2655
Modified:
trunk/lwgeom/lwgeom_transform.c
Log:
Add missing methods to the PROJ.4 cache memory context to prevent a backend crash caused by a NULL pointer dereference when PostgreSQL is trying to clean up memory contexts. Per report from Tom Lane.
Modified: trunk/lwgeom/lwgeom_transform.c
===================================================================
--- trunk/lwgeom/lwgeom_transform.c 2007-07-12 17:20:24 UTC (rev 2654)
+++ trunk/lwgeom/lwgeom_transform.c 2007-07-12 20:33:23 UTC (rev 2655)
@@ -144,6 +144,9 @@
/* Memory context cache functions */
static void PROJ4SRSCacheInit(MemoryContext context);
static void PROJ4SRSCacheDelete(MemoryContext context);
+static void PROJ4SRSCacheReset(MemoryContext context);
+static bool PROJ4SRSCacheIsEmpty(MemoryContext context);
+static void PROJ4SRSCacheStats(MemoryContext context);
#ifdef MEMORY_CONTEXT_CHECKING
static void PROJ4SRSCacheCheck(MemoryContext context);
#endif
@@ -156,7 +159,7 @@
NULL,
NULL,
PROJ4SRSCacheInit,
- NULL,
+ PROJ4SRSCacheReset,
PROJ4SRSCacheDelete
#ifdef MEMORY_CONTEXT_CHECKING
,PROJ4SRSCacheCheck
@@ -170,10 +173,10 @@
NULL,
NULL,
PROJ4SRSCacheInit,
- NULL,
+ PROJ4SRSCacheReset,
PROJ4SRSCacheDelete,
NULL,
- NULL
+ PROJ4SRSCacheIsEmpty
#ifdef MEMORY_CONTEXT_CHECKING
,PROJ4SRSCacheCheck
#endif
@@ -186,11 +189,11 @@
NULL,
NULL,
PROJ4SRSCacheInit,
- NULL,
+ PROJ4SRSCacheReset,
PROJ4SRSCacheDelete,
NULL,
- NULL,
- NULL
+ PROJ4SRSCacheIsEmpty,
+ PROJ4SRSCacheStats
#ifdef MEMORY_CONTEXT_CHECKING
,PROJ4SRSCacheCheck
#endif
@@ -229,6 +232,36 @@
DeletePJHashEntry(context);
}
+static void
+PROJ4SRSCacheReset(MemoryContext context)
+{
+ /*
+ * Do nothing, but we must supply a function since this call is mandatory according to tgl
+ * (see postgis-devel archives July 2007)
+ */
+}
+
+static bool
+PROJ4SRSCacheIsEmpty(MemoryContext context)
+{
+ /*
+ * Always return false since this call is mandatory according to tgl
+ * (see postgis-devel archives July 2007)
+ */
+ return FALSE;
+}
+
+static void
+PROJ4SRSCacheStats(MemoryContext context)
+{
+ /*
+ * Simple stats display function - we must supply a function since this call is mandatory according to tgl
+ * (see postgis-devel archives July 2007)
+ */
+
+ fprintf(stderr, "%s: PROJ4 context\n", context->name);
+}
+
#ifdef MEMORY_CONTEXT_CHECKING
static void
PROJ4SRSCacheCheck(MemoryContext context)
@@ -460,7 +493,7 @@
PJMemoryContext = MemoryContextCreate(T_AllocSetContext, 8192,
&PROJ4SRSCacheContextMethods,
PROJ4Cache->PROJ4SRSCacheContext,
- "PROJ4 PJ Memory Context");
+ "PostGIS PROJ4 PJ Memory Context");
/* Create the backend hash if it doesn't already exist */
if (!PJHash)
More information about the postgis-commits
mailing list