Opened 20 years ago

Closed 20 years ago

#640 closed defect (fixed)

Fontset and Symbolset not copied in msCopyMap

Reported by: sgillies@… Owned by: sgillies@…
Priority: high Milestone:
Component: MapServer C Library Version: 4.3
Severity: normal Keywords:
Cc:

Description

Aiming to get fontsets and symbolsets copied properly for 4.4 milestone.

Change History (2)

comment:1 by mturk@…, 20 years ago

Here is the patch for copySymbol.
The bug is like on many places caused by copyStringProperty.
In fact copyStringPropertyRealloc should be used cause destructor for each
object frees the string like it was malloced, so the same pointer is freed twice.

The same should be applied to fontset too.


Index: mapsymbol.c
===================================================================
RCS file: /data2/cvsroot/mapserver/mapsymbol.c,v
retrieving revision 1.61
diff -u -r1.61 mapsymbol.c
--- mapsymbol.c	16 Apr 2004 20:19:39 -0000	1.61
+++ mapsymbol.c	30 May 2004 18:36:42 -0000
@@ -722,7 +722,7 @@
 int msCopySymbol(symbolObj *dst, symbolObj *src, mapObj *map) {
   int i;
   initSymbol(dst);
-  copyStringProperty(&(dst->name), src->name);
+  copyStringPropertyRealloc(&(dst->name), src->name);
   copyProperty(&(dst->type), &(src->type), sizeof(int));
   copyProperty(&(dst->inmapfile), &(src->inmapfile), sizeof(int));
   copyProperty(&(dst->map), &map, sizeof(mapObj *));
@@ -752,15 +752,15 @@
                  src->img->sx, src->img->sy);
   }
 
-  copyStringProperty(&(dst->imagepath), src->imagepath);
+  copyStringPropertyRealloc(&(dst->imagepath), src->imagepath);
   copyProperty(&(dst->transparent), &(src->transparent),sizeof(int));
   
   copyProperty(&(dst->transparentcolor), &(src->transparentcolor),
                sizeof(int));
   
-  copyStringProperty(&(dst->character), src->character);
+  copyStringPropertyRealloc(&(dst->character), src->character);
   copyProperty(&(dst->antialias), &(src->antialias), sizeof(int));
-  copyStringProperty(&(dst->font), src->font);
+  copyStringPropertyRealloc(&(dst->font), src->font);
   copyProperty(&(dst->gap), &(src->gap), sizeof(int));
   copyProperty(&(dst->position), &(src->position), sizeof(int));
   copyProperty(&(dst->linecap), &(src->linecap), sizeof(int));
@@ -782,7 +782,7 @@
 {
   int i, return_value;
   
-  copyStringProperty(&(dst->filename), src->filename);
+  copyStringPropertyRealloc(&(dst->filename), src->filename);
   copyProperty(&(dst->map), &map, sizeof(mapObj *));
 
   dst->fontset = &(map->fontset);
@@ -801,14 +801,17 @@
       return(MS_FAILURE);
     }
   }
-
+#if 0
+  /* No need to copy the imagecache cause the images have diferent pointers
+   * Perhaps the image reference can be used so that images don't get copyied
+   */
   copyProperty(&(dst->imagecachesize),
                &(src->imagecachesize), sizeof(int));
   
   // I have a feeling that the code below is not quite right - Sean
   copyProperty(&(dst->imagecache), &(src->imagecache),
                sizeof(struct imageCacheObj));
-
+#endif
   return(MS_SUCCESS);
 }
 

comment:2 by sgillies@…, 20 years ago

Resolution: fixed
Status: newclosed
Fixed this in 4.2 as well as 4.3.
Note: See TracTickets for help on using tickets.