From ed2abdb9a222b591361856beea5a4e80a52f8bdd Mon Sep 17 00:00:00 2001 From: mterwoord_cp <7cd3fd84a0151ea055c2f79e4d2eef9576fe9afesxUZAwxD> Date: Mon, 2 Aug 2010 12:53:26 +0000 Subject: [PATCH] --- .../Cosmos.Debug.Common/CDebugger/DebugConnector.cs | 7 ++++++- .../CDebugger/DebugConnectorStream.cs | 10 ++++++++++ .../Cosmos.Debug.VSDebugEngine/AD7.Impl/AD7Process.cs | 4 ++++ source2/VSIP/Cosmos.VS.Package/VsProjectConfig.cs | 1 + 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/source2/Debug/Cosmos.Debug.Common/CDebugger/DebugConnector.cs b/source2/Debug/Cosmos.Debug.Common/CDebugger/DebugConnector.cs index 5174b03a3..fdff8b080 100644 --- a/source2/Debug/Cosmos.Debug.Common/CDebugger/DebugConnector.cs +++ b/source2/Debug/Cosmos.Debug.Common/CDebugger/DebugConnector.cs @@ -8,7 +8,7 @@ using System.Windows.Forms; namespace Cosmos.Debug.Common.CDebugger { - public abstract class DebugConnector { + public abstract class DebugConnector: IDisposable { //TODO: These should not be this way and should in fact // be checked or better yet done by constructor arguments // but that puts a restriction on where the sub classes @@ -103,6 +103,11 @@ namespace Cosmos.Debug.Common.CDebugger } } + public virtual void Dispose() + { + GC.SuppressFinalize(this); + } + protected void PacketTextSize(byte[] aPacket) { Next(GetUInt16(aPacket, 0), PacketText); } diff --git a/source2/Debug/Cosmos.Debug.Common/CDebugger/DebugConnectorStream.cs b/source2/Debug/Cosmos.Debug.Common/CDebugger/DebugConnectorStream.cs index 87c53c9be..1bb2baede 100644 --- a/source2/Debug/Cosmos.Debug.Common/CDebugger/DebugConnectorStream.cs +++ b/source2/Debug/Cosmos.Debug.Common/CDebugger/DebugConnectorStream.cs @@ -45,6 +45,16 @@ namespace Cosmos.Debug.Common.CDebugger { // Request first command Next(1, PacketCommand); } + + public override void Dispose() + { + if (mStream != null) + { + mStream.Close(); + mStream = null; + } + base.Dispose(); + } protected override void PacketTracePoint(byte[] aPacket) { CmdTrace(mCurrentMsgType, GetUInt32(aPacket, 0)); diff --git a/source2/Debug/Cosmos.Debug.VSDebugEngine/AD7.Impl/AD7Process.cs b/source2/Debug/Cosmos.Debug.VSDebugEngine/AD7.Impl/AD7Process.cs index a17954940..f90f8f6e7 100644 --- a/source2/Debug/Cosmos.Debug.VSDebugEngine/AD7.Impl/AD7Process.cs +++ b/source2/Debug/Cosmos.Debug.VSDebugEngine/AD7.Impl/AD7Process.cs @@ -369,6 +369,8 @@ namespace Cosmos.Debug.VSDebugEngine { { mProcess.Kill(); mProcess.Exited -= mProcess_Exited; + mDbgConnector.Dispose(); + mDbgConnector = null; return VSConstants.S_OK; } @@ -394,6 +396,8 @@ namespace Cosmos.Debug.VSDebugEngine { Trace.WriteLine(String.Format("Process Exit Code: {0}", mProcess.ExitCode)); //AD7ThreadDestroyEvent.Send(mEngine, mThread, (uint)mProcess.ExitCode); //mCallback.OnProgramDestroy((uint)mProcess.ExitCode); + mDbgConnector.Dispose(); + mDbgConnector = null; mCallback.OnProcessExit((uint)mProcess.ExitCode); } diff --git a/source2/VSIP/Cosmos.VS.Package/VsProjectConfig.cs b/source2/VSIP/Cosmos.VS.Package/VsProjectConfig.cs index 737cdf102..46349755a 100644 --- a/source2/VSIP/Cosmos.VS.Package/VsProjectConfig.cs +++ b/source2/VSIP/Cosmos.VS.Package/VsProjectConfig.cs @@ -53,6 +53,7 @@ namespace Cosmos.VS.Package xValues.Add("DebugMode", this.GetConfigurationProperty("DebugMode", true)); xValues.Add("TraceAssemblies", this.GetConfigurationProperty("TraceAssemblies", true)); xValues.Add("BuildTarget", this.GetConfigurationProperty("BuildTarget", true)); + xValues.Add("ProjectFile", Path.Combine(ProjectMgr.ProjectFolder, ProjectMgr.ProjectFile)); xInfo.bstrExe = NameValueCollectionHelper.DumpToString(xValues);