[mapserver-commits] r7208 - in trunk/mapserver/mapscript/csharp: . examples

svn at osgeo.org svn at osgeo.org
Sat Dec 22 17:19:55 EST 2007


Author: tamas
Date: 2007-12-22 17:19:55 -0500 (Sat, 22 Dec 2007)
New Revision: 7208

Modified:
   trunk/mapserver/mapscript/csharp/csmodule.i
   trunk/mapserver/mapscript/csharp/examples/RFC24.cs
Log:
Added more tests and give ownership to the C memory at the ctor of layerObj, classObj and styleObj (#2442)

Modified: trunk/mapserver/mapscript/csharp/csmodule.i
===================================================================
--- trunk/mapserver/mapscript/csharp/csmodule.i	2007-12-22 20:32:11 UTC (rev 7207)
+++ trunk/mapserver/mapscript/csharp/csmodule.i	2007-12-22 22:19:55 UTC (rev 7208)
@@ -328,15 +328,15 @@
  * with parent objects (causing nullreference exception, Bug 1743)
  *****************************************************************************/
 
-%typemap(csconstruct, excode=SWIGEXCODE) layerObj(mapObj map) %{: this($imcall, (map == null) , map) {
+%typemap(csconstruct, excode=SWIGEXCODE) layerObj(mapObj map) %{: this($imcall, true , map) {
   $excode
 }
 %}
-%typemap(csconstruct, excode=SWIGEXCODE) classObj(layerObj layer) %{: this($imcall, (layer == null), layer) {
+%typemap(csconstruct, excode=SWIGEXCODE) classObj(layerObj layer) %{: this($imcall, true, layer) {
   $excode
 }
 %}
-%typemap(csconstruct, excode=SWIGEXCODE) styleObj(classObj parent_class) %{: this($imcall, (parent_class == null), parent_class) {
+%typemap(csconstruct, excode=SWIGEXCODE) styleObj(classObj parent_class) %{: this($imcall, true, parent_class) {
   $excode
 }
 %}

Modified: trunk/mapserver/mapscript/csharp/examples/RFC24.cs
===================================================================
--- trunk/mapserver/mapscript/csharp/examples/RFC24.cs	2007-12-22 20:32:11 UTC (rev 7207)
+++ trunk/mapserver/mapscript/csharp/examples/RFC24.cs	2007-12-22 22:19:55 UTC (rev 7208)
@@ -133,10 +133,11 @@
 	public void testLayerObj() {
 		mapObj map=new mapObj(mapfile);
 		layerObj newLayer=new layerObj(map);
-		
+
 		map=null;
 		gc();
 		assertNotNull(newLayer.map, "testLayerObj");
+		assert(newLayer.refcount == 2, "testLayerObj refcount");
 	}
 	
 	public void testInsertLayerObj() {
@@ -147,6 +148,7 @@
 		map=null;
 		gc();
 		assertNotNull(newLayer.map, "testInsertLayerObj");
+		assert(newLayer.refcount == 2, "testInsertLayerObj refcount");
 	}
 	
 	public void testGetLayerObj() {
@@ -156,6 +158,7 @@
 		map=null;
 		gc();
 		assertNotNull(newLayer.map, "testGetLayerObj");
+		assert(newLayer.refcount == 2, "testGetLayerObj refcount");
 	}
 
 	public void testGetLayerObjByName() {
@@ -165,6 +168,7 @@
 		map=null;
 		gc();
 		assertNotNull(newLayer.map, "testGetLayerObjByName");
+		assert(newLayer.refcount == 2, "testGetLayerObjByName refcount");
 	}
 
 	public void testClassObj() {
@@ -175,6 +179,7 @@
 		map=null; layer=null;
 		gc();
 		assertNotNull(newClass.layer, "testClassObj");
+		assert(newClass.refcount == 2, "testClassObj refcount");
 	}
 
 	public void testStyleObj() 
@@ -199,6 +204,7 @@
 		map=null; layer=null;
 		gc();
 		assertNotNull(newClass.layer, "testInsertClassObj");
+		assert(newClass.refcount == 2, "testInsertClassObj refcount");
 	}
 
 	public void testInsertStyleObj() 
@@ -223,6 +229,7 @@
 		map=null; layer=null;
 		gc();
 		assertNotNull(newClass.layer, "testGetClassObj");
+		assert(newClass.refcount == 2, "testGetClassObj refcount");
 	}
 
 	public void testGetStyleObj() 



More information about the mapserver-commits mailing list