MapServer / MapServer-import

3 stars 2 forks source link

Mapscript/cloneMap/Processing #1399

Open tbonfort opened 12 years ago

tbonfort commented 12 years ago

Reporter: umn-ms@hydrotec.de Date: 2005/06/28 - 16:41

We are using MapScript/Java inside Tomcat. 
We encountered a crash in webObj.cloneMap() when 
a PROCESSING-statement was used inside a Layer-Block. 

My impression is, that there is a bug in mapcopy.c/msCopyLayer (?) 

I think: After the line 
      MS_COPYSTELEM(numprocessing); 
and before the loop 
      for (i = 0; i < dst->numprocessing; i++) {...} 
a memory-allocation for dst->processing is missing. 

I made a change: 
  MS_COPYSTELEM(numprocessing);  //OLD 
  // Allocating an initializing memory for processing-array. 
  // Must be dst->numprocessing+1 to be 0-terminated. 
  dst->processing 
     = numprocessing ?
          (char*) calloc(dst->numprocessing+1,sizeof(char*)) : 
          0; 
  for (i = 0; i < dst->numprocessing; i++) {   //OLD 
  ... 

I hope this is helpful. Greetings 
Benedikt Rothe
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2005/06/28 - 17:40

I think that code like this

for (i = 0; i < dst->numprocessing; i++) {
    msLayerAddProcessing(dst, msLayerGetProcessing(src, i));
}

is the best way to go. I'm cc'ing FrankW to get his advice on using the 
processing functions.
tbonfort commented 12 years ago

Author: fwarmerdam Date: 2005/06/28 - 18:15

Sean's proposal accomplishes the same thing, and somewhat more cleanly.  I 
would suggest it. 
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2005/06/28 - 19:12

Fix committed to CVS HEAD (4.7) and branch-4-6 (mapcopy.c revision 1.40.2.1).
I've added a processing directive to one of the layers in the mapscript test
fixture and verified that the layer can be copied without problems.