[mapguide-commits] r10294 - branches/4.0/MgDev/Common/PlatformBase/MapLayer

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Nov 18 14:46:02 PST 2026


Author: jng
Date: 2026-11-18 14:45:59 -0800 (Wed, 18 Nov 2026)
New Revision: 10294

Modified:
   branches/4.0/MgDev/Common/PlatformBase/MapLayer/SelectionBase.cpp
Log:
Plug leak from previous change

Modified: branches/4.0/MgDev/Common/PlatformBase/MapLayer/SelectionBase.cpp
===================================================================
--- branches/4.0/MgDev/Common/PlatformBase/MapLayer/SelectionBase.cpp	2026-11-18 15:43:39 UTC (rev 10293)
+++ branches/4.0/MgDev/Common/PlatformBase/MapLayer/SelectionBase.cpp	2026-11-18 22:45:59 UTC (rev 10294)
@@ -44,7 +44,22 @@
 {
     m_map = SAFE_ADDREF(map);
     m_stream = new MgMemoryStreamHelper();
-    FromXml(xmlSelectionString);
+
+    try
+    {
+        FromXml(xmlSelectionString);
+    }
+    catch (...)
+    {
+        // FromXml rejects a selection string that is not XML by throwing, and a constructor that
+        // throws runs no destructor, so everything this object has taken so far has to go back
+        // here. m_stream is a raw pointer and m_selections owns the lists it holds; m_map is a Ptr,
+        // whose destructor does run while the object unwinds.
+        ClearSelections();
+        delete m_stream;
+        m_stream = NULL;
+        throw;
+    }
 }
 
 



More information about the mapguide-commits mailing list