Skip to content

Commit 57aba20

Browse files
Krister Wicksellrouault
authored andcommitted
Don't remove all memory files before creating a new.
When WMS layers use memory files as temporary storage we can't delete all existing memory files before creating a new. This will generate a lot of "Unable to access file..." errors in a multi-threded application that uses MapScript. However, we can always remove the temporary memory files even if the layer has debug enabled.
1 parent 2039bca commit 57aba20

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

mapwmslayer.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,7 +1414,6 @@ int msDrawWMSLayerLow(int nLayerId, httpRequestObj *pasReqInfo,
14141414
* to attach a "VSI" name to this buffer.
14151415
* ------------------------------------------------------------------ */
14161416
if( pasReqInfo[iReq].pszOutputFile == NULL ) {
1417-
msCleanVSIDir( "/vsimem/msout" );
14181417
mem_filename = msTmpFile(map, NULL, "/vsimem/msout/", "img.tmp" );
14191418

14201419
VSIFCloseL(
@@ -1496,7 +1495,7 @@ int msDrawWMSLayerLow(int nLayerId, httpRequestObj *pasReqInfo,
14961495
if (msDrawLayer(map, lp, img) != 0)
14971496
status = MS_FAILURE;
14981497

1499-
if (!lp->debug)
1498+
if (!lp->debug || mem_filename != NULL)
15001499
VSIUnlink( wldfile );
15011500
} else {
15021501
msSetError(MS_WMSCONNERR,
@@ -1508,7 +1507,7 @@ int msDrawWMSLayerLow(int nLayerId, httpRequestObj *pasReqInfo,
15081507
}
15091508

15101509
/* We're done with the remote server's response... delete it. */
1511-
if (!lp->debug)
1510+
if (!lp->debug || mem_filename != NULL)
15121511
VSIUnlink(lp->data);
15131512

15141513
/* restore prveious type */

0 commit comments

Comments
 (0)