[mapguide-commits] r6107 - in trunk/Tools/Maestro: Maestro.AddIn.Local Maestro.AddIn.Local/Commands Maestro.Editors/Common Maestro.Editors/LayerDefinition/Vector/Thematics OSGeo.MapGuide.MaestroAPI OSGeo.MapGuide.MaestroAPI.Local OSGeo.MapGuide.MaestroAPI.Native

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Aug 31 11:23:54 EDT 2011


Author: jng
Date: 2011-08-31 08:23:54 -0700 (Wed, 31 Aug 2011)
New Revision: 6107

Modified:
   trunk/Tools/Maestro/Maestro.AddIn.Local/Commands/StartupCommand.cs
   trunk/Tools/Maestro/Maestro.AddIn.Local/MapGuideDesktopUnmanagedApi.dll
   trunk/Tools/Maestro/Maestro.AddIn.Local/MgDesktop.dll
   trunk/Tools/Maestro/Maestro.AddIn.Local/OSGeo.MapGuide.Desktop.dll
   trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs
   trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Thematics/ThemeCreator.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeDataReader.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeFeatureReader.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeSqlReader.cs
   trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/PlatformConnectionBase.cs
Log:
 - Update MgDesktop binaries (Revision 82614b4685)
 - Close all readers that we receive because for the Local Connection mode, failure to do so will result in FDO connection leaks.
 - Delete session files created by the MgDesktop library on application exit.

Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/Commands/StartupCommand.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.AddIn.Local/Commands/StartupCommand.cs	2011-08-31 06:23:07 UTC (rev 6106)
+++ trunk/Tools/Maestro/Maestro.AddIn.Local/Commands/StartupCommand.cs	2011-08-31 15:23:54 UTC (rev 6107)
@@ -26,6 +26,7 @@
 using System.IO;
 using Maestro.Base.Services;
 using Maestro.AddIn.Local.Services;
+using OSGeo.MapGuide;
 
 namespace Maestro.AddIn.Local.Commands
 {
@@ -40,11 +41,26 @@
                     LocalConnection.Create);
 
                 ResourcePreviewerFactory.RegisterPreviewer(LocalConnection.PROVIDER_NAME, new LocalPreviewer());
+
+                System.Windows.Forms.Application.ApplicationExit += new EventHandler(OnAppExit);
             }
             else
             {
                 LoggingService.Info("Skipping local connection provider registration because I am guessing we're running Mono on Linux/Mac"); //LOCALIZEME
             }
         }
+
+        void OnAppExit(object sender, EventArgs e)
+        {
+            try
+            {
+                MgdResourceService resSvc = MgServiceFactory.CreateResourceService();
+                resSvc.DeleteSessionFiles();
+            }
+            catch (MgException ex)
+            {
+                ex.Dispose();
+            }
+        }
     }
 }

Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/MapGuideDesktopUnmanagedApi.dll
===================================================================
(Binary files differ)

Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/MgDesktop.dll
===================================================================
(Binary files differ)

Modified: trunk/Tools/Maestro/Maestro.AddIn.Local/OSGeo.MapGuide.Desktop.dll
===================================================================
(Binary files differ)

Modified: trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs	2011-08-31 06:23:07 UTC (rev 6106)
+++ trunk/Tools/Maestro/Maestro.Editors/Common/ExpressionEditor.cs	2011-08-31 15:23:54 UTC (rev 6107)
@@ -778,6 +778,7 @@
                                     else
                                         values[Convert.ToString(rd[ColumnName.Text], System.Globalization.CultureInfo.InvariantCulture)] = null;
                                 }
+                                rd.Close();
                             }
                         }
                         catch (Exception ex)

Modified: trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Thematics/ThemeCreator.cs
===================================================================
--- trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Thematics/ThemeCreator.cs	2011-08-31 06:23:07 UTC (rev 6106)
+++ trunk/Tools/Maestro/Maestro.Editors/LayerDefinition/Vector/Thematics/ThemeCreator.cs	2011-08-31 15:23:54 UTC (rev 6107)
@@ -241,6 +241,7 @@
                                     m_values[value]++;
                                 }
                             }
+                            rd.Close();
                         }
 
                         rawEx = null; //Clear error

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/PlatformConnectionBase.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/PlatformConnectionBase.cs	2011-08-31 06:23:07 UTC (rev 6106)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/PlatformConnectionBase.cs	2011-08-31 15:23:54 UTC (rev 6107)
@@ -1584,6 +1584,8 @@
                     }
                     else
                         throw new Exception("No data found in resource: " + resourceID);
+
+                    fsr.Close();
                 }
             }
             catch

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs	2011-08-31 06:23:07 UTC (rev 6106)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs	2011-08-31 15:23:54 UTC (rev 6107)
@@ -414,10 +414,10 @@
         {
             var fes = GetFeatureService();
             MgSpatialContextReader rd = fes.GetSpatialContexts(new MgResourceIdentifier(resourceID), activeOnly);
-
             LogMethodCall("MgFeatureService::GetSpatialContexts", true, resourceID, activeOnly.ToString());
-
-            return this.DeserializeObject(typeof(FdoSpatialContextList), Native.Utility.MgStreamToNetStream(rd, rd.GetType().GetMethod("ToXml"), null)) as FdoSpatialContextList;
+            var scList = this.DeserializeObject(typeof(FdoSpatialContextList), Native.Utility.MgStreamToNetStream(rd, rd.GetType().GetMethod("ToXml"), null)) as FdoSpatialContextList;
+            rd.Close();
+            return scList;
         }
 
         public override string[] GetIdentityProperties(string resourceID, string classname)

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeDataReader.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeDataReader.cs	2011-08-31 06:23:07 UTC (rev 6106)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeDataReader.cs	2011-08-31 15:23:54 UTC (rev 6107)
@@ -51,14 +51,27 @@
 
         public override void Close()
         {
-            _reader.Close();
+            if (_reader != null)
+            {
+                _reader.Close();
+                _reader.Dispose();
+                _reader = null;
+            }
         }
 
         public override void Dispose()
         {
-            _reader.Dispose();
-            _agfRw.Dispose();
-            _wktRw.Dispose();
+            Close();
+            if (_agfRw != null)
+            {
+                _agfRw.Dispose();
+                _agfRw = null;
+            }
+            if (_wktRw != null)
+            {
+                _wktRw.Dispose();
+                _wktRw = null;
+            }
             base.Dispose();
         }
 

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeFeatureReader.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeFeatureReader.cs	2011-08-31 06:23:07 UTC (rev 6106)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeFeatureReader.cs	2011-08-31 15:23:54 UTC (rev 6107)
@@ -53,15 +53,28 @@
 
         public override void Dispose()
         {
-            _reader.Dispose();
-            _agfRw.Dispose();
-            _wktRw.Dispose();
+            Close();
+            if (_agfRw != null)
+            {
+                _agfRw.Dispose();
+                _agfRw = null;
+            }
+            if (_wktRw != null)
+            {
+                _wktRw.Dispose();
+                _wktRw = null;
+            }
             base.Dispose();
         }
 
         public override void Close()
         {
-            _reader.Close();
+            if (_reader != null)
+            {
+                _reader.Close();
+                _reader.Dispose();
+                _reader = null;
+            }
         }
     }
 }

Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeSqlReader.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeSqlReader.cs	2011-08-31 06:23:07 UTC (rev 6106)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeSqlReader.cs	2011-08-31 15:23:54 UTC (rev 6107)
@@ -48,9 +48,17 @@
 
         public override void Dispose()
         {
-            _reader.Dispose();
-            _agfRw.Dispose();
-            _wktRw.Dispose();
+            Close();
+            if (_agfRw != null)
+            {
+                _agfRw.Dispose();
+                _agfRw = null;
+            }
+            if (_wktRw != null)
+            {
+                _wktRw.Dispose();
+                _wktRw = null;
+            }
             base.Dispose();
         }
 



More information about the mapguide-commits mailing list