[mapguide-internals] Patch for ticket 1304: Possible bug in constructor MgSelection (MgMap *map, CREFSTRING xmlSelectionString) triggered by empty xmlSelectionString
Walt Welton-Lair
walt.welton-lair at autodesk.com
Mon Jun 11 11:20:58 PDT 2012
Before you clear m_selections in MgSelectionBase::FromXml you need to also delete the referenced sub-objects. See the code in ~MgSelectionBase.
Consider the following code:
Ptr<MgMap> map1 = new MgMap(m_siteConnection);
...
Ptr<MgSelection> sel = new MgSelection(map1);
sel.FromXml(...);
sel.FromXml(...);
The second call to FromXml would create a memory leak
Just create a private ClearSelections helper that does the cleanup work and have both the destructor and FromXml call it.
Walt
-----Original Message-----
From: mapguide-internals-bounces at lists.osgeo.org [mailto:mapguide-internals-bounces at lists.osgeo.org] On Behalf Of Jackie Ng
Sent: Monday, June 11, 2012 2:40 AM
To: mapguide-internals at lists.osgeo.org
Subject: [mapguide-internals] Patch for ticket 1304: Possible bug in constructor MgSelection (MgMap *map, CREFSTRING xmlSelectionString) triggered by empty xmlSelectionString
Hi All,
I've attached a patch for ticket 1304
http://trac.osgeo.org/mapguide/ticket/1304
Please review. Thanks
- Jackie
--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Patch-for-ticket-1304-Possible-bug-in-constructor-MgSelection-MgMap-map-CREFSTRING-xmlSelectionString-tp4980283.html
Sent from the MapGuide Internals mailing list archive at Nabble.com.
_______________________________________________
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