Howard, I have been a bit imprecise. Creating and manipulating maps dinamically is mostly safe, with the exception of some objects and/or usage patterns. I dinamically add some simple layers myself in an application and it works.
Sorry for the imprecision. Umberto On 11/9/06, Howard Butler <[EMAIL PROTECTED]> wrote:
On Nov 9, 2006, at 2:01 AM, Umberto Nicoletti wrote: > On 11/9/06, John Cartwright <[EMAIL PROTECTED]> wrote: >> Hello All, >> >> I'm trying to use python mapscript (4.10.0) on MacOS 10.4 to create a >> map dynamically and output the image. Code seems to segfault at the >> termination of the program. Can anyone see what I'm doing wrong or >> suggest a method of tracing the problem? > > John, > you are not doing anything wrong, simply mapsscript doesn't have > properly implemented memory management so creating maps dinamically is > not supported (even though it could work). > I think in your case you should get the image correctly drawn anyway, > so you could ignore the (annoying) segfault at program exit. Umberto, Creating maps dynamically is the entire point of MapScript. It very much supports the concept of creating maps dynamically. IIRC, the code John has posted is right out of an example that Sean and I did for a workshop at OSG '05. It may be that this example is no longer valid in 4.10 because of how the memory management has changed, but I wouldn't go so far as to say MapScript's memory management is outright implemented incorrectly. There may be some issues, and it may be a little rough in areas, but it has been improving. I suspect that the colorObjs of the styleObjs are not properly referencing the styleObj. Running this script through gdb to get a traceback to find out which destructor is being called is what probably needs to be done. Howard
