[geos-commits] r2975 - in branches/3.2: . capi source/headers/geos tests/unit

svn_geos at osgeo.org svn_geos at osgeo.org
Sat Apr 17 17:55:55 EDT 2010


Author: strk
Date: 2010-04-17 17:55:53 -0400 (Sat, 17 Apr 2010)
New Revision: 2975

Modified:
   branches/3.2/NEWS
   branches/3.2/capi/geos_c.cpp
   branches/3.2/capi/geos_c.h.in
   branches/3.2/capi/geos_ts_c.cpp
   branches/3.2/configure.in
   branches/3.2/source/headers/geos/version.h.vc
   branches/3.2/tests/unit/Makefile.am
Log:
Back-port fix of GEOS-context leakage


Modified: branches/3.2/NEWS
===================================================================
--- branches/3.2/NEWS	2010-04-17 15:34:55 UTC (rev 2974)
+++ branches/3.2/NEWS	2010-04-17 21:55:53 UTC (rev 2975)
@@ -1,3 +1,8 @@
+Changes in 3.2.2-svn
+ 
+- Bug fixes:
+  - CAPI: do not leak contexts when using the non-reentrant interface
+
 Changes in 3.2.1 
 
 - Bug fixes:

Modified: branches/3.2/capi/geos_c.cpp
===================================================================
--- branches/3.2/capi/geos_c.cpp	2010-04-17 15:34:55 UTC (rev 2974)
+++ branches/3.2/capi/geos_c.cpp	2010-04-17 21:55:53 UTC (rev 2975)
@@ -85,10 +85,23 @@
 
 extern "C" {
 
+GEOSMessageHandler
+GEOSContext_setNoticeHandler_r(GEOSContextHandle_t extHandle, GEOSMessageHandler nf);
+GEOSMessageHandler
+GEOSContext_setErrorHandler_r(GEOSContextHandle_t extHandle, GEOSMessageHandler nf);
+
 void
 initGEOS (GEOSMessageHandler nf, GEOSMessageHandler ef)
 {
-    handle = initGEOS_r( nf, ef );
+    if ( ! handle )
+    {
+        handle = initGEOS_r( nf, ef );
+    }
+    else
+    {
+        GEOSContext_setNoticeHandler_r(handle, nf);
+        GEOSContext_setErrorHandler_r(handle, ef);
+    }
 }
 
 void

Modified: branches/3.2/capi/geos_c.h.in
===================================================================
--- branches/3.2/capi/geos_c.h.in	2010-04-17 15:34:55 UTC (rev 2974)
+++ branches/3.2/capi/geos_c.h.in	2010-04-17 21:55:53 UTC (rev 2975)
@@ -55,8 +55,8 @@
 #include <geos/version.h>
 #define GEOS_CAPI_VERSION_MAJOR 1
 #define GEOS_CAPI_VERSION_MINOR 6
-#define GEOS_CAPI_VERSION_PATCH 1
-#define GEOS_CAPI_VERSION "3.2.1-CAPI-1.6.1"
+#define GEOS_CAPI_VERSION_PATCH 2
+#define GEOS_CAPI_VERSION "3.2.2-CAPI-1.6.2"
 #else
 #ifndef GEOS_VERSION_MAJOR
 #define GEOS_VERSION_MAJOR @VERSION_MAJOR@

Modified: branches/3.2/capi/geos_ts_c.cpp
===================================================================
--- branches/3.2/capi/geos_ts_c.cpp	2010-04-17 15:34:55 UTC (rev 2974)
+++ branches/3.2/capi/geos_ts_c.cpp	2010-04-17 21:55:53 UTC (rev 2975)
@@ -4,6 +4,7 @@
  *
  * C-Wrapper for GEOS library
  *
+ * Copyright (C) 2010 Sandro Santilli <strk at keybit.net>
  * Copyright (C) 2005-2006 Refractions Research Inc.
  *
  * This is free software; you can redistribute and/or modify it under
@@ -182,6 +183,40 @@
     return static_cast<GEOSContextHandle_t>(extHandle);
 }
 
+GEOSMessageHandler
+GEOSContext_setNoticeHandler_r(GEOSContextHandle_t extHandle, GEOSMessageHandler nf)
+{
+    GEOSMessageHandler f;
+    GEOSContextHandleInternal_t *handle = 0;
+    handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle);
+    if ( 0 == handle->initialized )
+    {
+        return NULL;
+    }
+
+    f = handle->NOTICE_MESSAGE;
+    handle->NOTICE_MESSAGE = nf;
+
+    return f;
+}
+
+GEOSMessageHandler
+GEOSContext_setErrorHandler_r(GEOSContextHandle_t extHandle, GEOSMessageHandler nf)
+{
+    GEOSMessageHandler f;
+    GEOSContextHandleInternal_t *handle = 0;
+    handle = reinterpret_cast<GEOSContextHandleInternal_t*>(extHandle);
+    if ( 0 == handle->initialized )
+    {
+        return NULL;
+    }
+
+    f = handle->ERROR_MESSAGE;
+    handle->ERROR_MESSAGE = nf;
+
+    return f;
+}
+
 void
 finishGEOS_r(GEOSContextHandle_t extHandle)
 {

Modified: branches/3.2/configure.in
===================================================================
--- branches/3.2/configure.in	2010-04-17 15:34:55 UTC (rev 2974)
+++ branches/3.2/configure.in	2010-04-17 21:55:53 UTC (rev 2975)
@@ -16,7 +16,7 @@
 
 dnl -- Version info for the CAPI
 CAPI_INTERFACE_CURRENT=7
-CAPI_INTERFACE_REVISION=1
+CAPI_INTERFACE_REVISION=2
 CAPI_INTERFACE_AGE=6
 
 dnl
@@ -25,7 +25,7 @@
 dnl
 VERSION_MAJOR=3
 VERSION_MINOR=2
-VERSION_PATCH=1
+VERSION_PATCH=2
 VERSION="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH"
 
 dnl CAPI_VERSION_MAJOR=$(($CAPI_INTERFACE_CURRENT-$CAPI_INTERFACE_AGE))

Modified: branches/3.2/source/headers/geos/version.h.vc
===================================================================
--- branches/3.2/source/headers/geos/version.h.vc	2010-04-17 15:34:55 UTC (rev 2974)
+++ branches/3.2/source/headers/geos/version.h.vc	2010-04-17 21:55:53 UTC (rev 2975)
@@ -35,11 +35,11 @@
 #endif
 
 #ifndef GEOS_VERSION_PATCH
-#define GEOS_VERSION_PATCH 1
+#define GEOS_VERSION_PATCH 2
 #endif
 
 #ifndef GEOS_VERSION
-#define GEOS_VERSION "3.2.1"
+#define GEOS_VERSION "3.2.2"
 #endif
 
 #ifndef GEOS_JTS_PORT

Modified: branches/3.2/tests/unit/Makefile.am
===================================================================
--- branches/3.2/tests/unit/Makefile.am	2010-04-17 15:34:55 UTC (rev 2974)
+++ branches/3.2/tests/unit/Makefile.am	2010-04-17 21:55:53 UTC (rev 2975)
@@ -90,6 +90,7 @@
 	capi/GEOSSimplifyTest.cpp \
 	capi/GEOSPreparedGeometryTest.cpp \
 	capi/GEOSPolygonizer_getCutEdgesTest.cpp \
+	capi/GEOSGetCentroidTest.cpp \
 	capi/GEOSBufferTest.cpp
 
 noinst_HEADERS = \



More information about the geos-commits mailing list