[mapguide-internals] Some code fixes for RFC 60

UV uvwild at gmail.com
Fri May 8 08:29:18 EDT 2009

Thanks for the input. Much appreciated.

Added the delete.

Why did I use pointers?
I did use pointers as this leaves more flexibility for later improvements.
Also In the beginning I was not sure if the map object might be shared 
between threads or sessions.
I can imagine some use cases where this might be an issue.... at that 
stage different colorpalettes need to be handled and pointers would be 
more flexible.

To notice an eventual leak in the assignment I added the assert 
so its an odd coding but a destructive assignment does not leak it 
breaks ;) 
This is like a runtime check to understand whats happening in a 
multithreaded server.
So its the same  for now.

I added those things now.... the Coordsys error message (#980) is also 
I  commented out the experimental exception throw in StylizeLayers...


Walt Welton-Lair wrote:
> UV,
> Two fixes:
> * Change your GetResourceServiceForMapDef method in ServerTileService to simply return an MgResourceService* (properly addref'ed) and not a smart-pointer.  We don't have any methods which return smart-pointers.  It's up to the calling code to decide if it wants to wrap the method's return value in a smart-pointer.
> * In MapLayer/Map.cpp you have numerous memory leaks.  You allocate a new STRCOLORLIST (assigning it to the m_colorPalette member variable), but don't delete it anywhere.  Instead you only call clear on the list, which isn't the same as deleting the object.  SetColorPalette also leaks any previously allocated m_colorPalette.  I would simply change m_colorPalette to be a STRCOLORLIST instead of a PSTRCOLORLIST.  GetColorPalette then returns the address of m_colorPalette, and SetColorPalette replaces the contents of m_colorPalette with the supplied palette.
> Thanks,
> Walt
>  W       E         @__   __o
>    A   T   R   @___    _ \<,_
>      L           @_   (*)/ (*)
> _______________________________________________
> mapguide-internals mailing list
> mapguide-internals at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-internals

More information about the mapguide-internals mailing list