Opened 8 years ago

#4138 new defect

mapObj does not close MS_ERRORFILE handle in MapServer 6.0.1

Reported by: panzel Owned by: tamas
Priority: normal Milestone:
Component: MapScript-C# Version: 6.0
Severity: normal Keywords:
Cc:

Description

I believe that the mapObj's Dispose() method does not close the file handle for the MS_ERRORFILE under MapServer 6.0, when used via the SWIG MapScript? API for C#.

Here's the context, presented as C# fragments:

  using OSGeo.MapServer;
  ...
  string mapfile = @"MAP
     CONFIG 'MS_ERRORFILE' "c:/.../mapserver.log"
     DEBUG 3
     imagetype 'png'
        ...
     LAYER
        ...
     END
   END";
  mapObj mo = mapscript.msLoadMapFromString(mapfile, null);
  imageObj io = mo.draw();
  mo.Dispose();
  byte[] img = io.getBytes();
  ...dump the "img" to a file (such as a ".png" file)
  io.Dispose;

By way of demonstration, if I use this code in a "Console" application, and set a break point right after the "io.Dispose", a directory listing shows a zero length for the mapserver.log file. If I let the application terminate normally, I see the size of the mapserver.log file grow to the expected 1KB or so, and I see that the file contains the expected elapsed time information appropriate to "DEBUG 3". In my test use, the "mapfile" string is well-formed and a reasonable ".png" file is created.

Should I be calling some additional method on the mapObj instance to force ERRORFILE file closure? Is there some other explanation for the behavior reported here?

Change History (0)

Note: See TracTickets for help on using tickets.