From 22f86ac9deb36be6091159cbf9c35f0b0f3d3070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Wed, 12 Apr 2006 15:27:16 +0000 Subject: [PATCH] Bugfix: Some native methods leaked into callstack git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1292 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/Threads/Function.cs | 4 +-- .../Project/Src/Threads/Thread.cs | 26 +++++++++---------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs index 60a34fe522..7560d9be71 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs @@ -111,8 +111,7 @@ namespace Debugger this.thread = thread; this.chainIndex = chainIndex; this.frameIndex = frameIndex; - this.corILFrame = corILFrame; - this.corILFramePauseSession = debugger.PauseSession; + this.CorILFrame = corILFrame; corFunction = corILFrame.Function; module = debugger.GetModule(corFunction.Module); @@ -137,6 +136,7 @@ namespace Debugger return corILFrame; } set { + if (value == null) throw new DebuggerException("Can not set frame to null"); corILFrame = value; corILFramePauseSession = debugger.PauseSession; } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs index 66d8bdea1e..182055ff77 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs @@ -191,9 +191,11 @@ namespace Debugger foreach(ICorDebugFrame corFrame in corFrameEnum.Enumerator) { frameIndex--; - Function function = GetFunctionFromCache(chainIndex, frameIndex, corFrame); - if (function != null) { - yield return function; + if (corFrame.Is()) { + Function function = GetFunctionFromCache(chainIndex, frameIndex, corFrame.As()); + if (function != null) { + yield return function; + } } } } @@ -206,7 +208,7 @@ namespace Debugger public Dictionary Frames = new Dictionary(); } - Function GetFunctionFromCache(uint chainIndex, uint frameIndex, ICorDebugFrame corFrame) + Function GetFunctionFromCache(uint chainIndex, uint frameIndex, ICorDebugILFrame corFrame) { try { if (chainCache.ContainsKey(chainIndex) && @@ -214,18 +216,14 @@ namespace Debugger !chainCache[chainIndex].Frames[frameIndex].HasExpired) { Function function = chainCache[chainIndex].Frames[frameIndex]; - function.CorILFrame = corFrame.As(); + function.CorILFrame = corFrame; return function; } else { - if (corFrame.Is()) { - Function function = new Function(this, chainIndex, frameIndex, corFrame.CastTo()); - if (!chainCache.ContainsKey(chainIndex)) chainCache[chainIndex] = new Chain(); - chainCache[chainIndex].Frames[frameIndex] = function; - function.Expired += delegate { chainCache[chainIndex].Frames.Remove(frameIndex); }; - return function; - } else { - return null; - } + Function function = new Function(this, chainIndex, frameIndex, corFrame.CastTo()); + if (!chainCache.ContainsKey(chainIndex)) chainCache[chainIndex] = new Chain(); + chainCache[chainIndex].Frames[frameIndex] = function; + function.Expired += delegate { chainCache[chainIndex].Frames.Remove(frameIndex); }; + return function; } } catch (COMException) { // TODO return null;