[mapserver-commits] r11558 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Wed Apr 13 12:43:21 EDT 2011


Author: tbonfort
Date: 2011-04-13 09:43:21 -0700 (Wed, 13 Apr 2011)
New Revision: 11558

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapdraw.c
Log:
clean up the symbolset if we've used an alternate renderer for a layer (#3834,#3616)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2011-04-13 15:56:55 UTC (rev 11557)
+++ trunk/mapserver/HISTORY.TXT	2011-04-13 16:43:21 UTC (rev 11558)
@@ -15,6 +15,8 @@
 Current Version (SVN trunk): 
 ---------------------------- 
 
+- clean up the symbolset if we've used an alternate renderer for a layer (#3834,#3616)
+
 - fix crash on embeded legend with cairo raster renderer
 
 - fix crashes in SVG renderer on polygon symbol fills (#3837)

Modified: trunk/mapserver/mapdraw.c
===================================================================
--- trunk/mapserver/mapdraw.c	2011-04-13 15:56:55 UTC (rev 11557)
+++ trunk/mapserver/mapdraw.c	2011-04-13 16:43:21 UTC (rev 11558)
@@ -733,14 +733,34 @@
       rendererVTableObj *renderer = MS_IMAGE_RENDERER(image);
       rendererVTableObj *altrenderer = MS_IMAGE_RENDERER(image_draw);
       rasterBufferObj rb;
+      int i;
       memset(&rb,0,sizeof(rasterBufferObj));
 
       altrenderer->endLayer(image_draw,map,layer);
 
       altrenderer->getRasterBufferHandle(image_draw,&rb);
       renderer->mergeRasterBuffer(image,&rb,layer->opacity*0.01,0,0,0,0,rb.width,rb.height);  
+      
+      /* 
+       * hack to work around bug #3834: if we have use an alternate renderer, the symbolset may contain
+       * symbols that reference it. We want to remove those references before the altFormat is destroyed
+       * to avoid a segfault and/or a leak, and so the the main renderer doesn't pick the cache up thinking
+       * it's for him.
+       */
+      for(i=0; i<map->symbolset.numsymbols; i++) {
+         if (map->symbolset.symbol[i]!=NULL) {
+            symbolObj *s = map->symbolset.symbol[i];
+            if(s->renderer == altrenderer) {
+	            altrenderer->freeSymbol(s);
+               s->renderer = NULL;
+            }
+         }
+      }
       msFreeImage(image_draw);
-      
+
+      /* set the imagetype from the original outputformat back (it was removed by msSelectOutputFormat() */
+      msFree(map->imagetype);
+      map->imagetype = msStrdup(image->format->name);
   }
   else if( image != image_draw) {
 	  rendererVTableObj *renderer = MS_IMAGE_RENDERER(image_draw);



More information about the mapserver-commits mailing list