From eaf7f695898ddc7a8e41986ee4a90a5694fb3b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Sun, 28 Feb 2010 17:58:15 +0000 Subject: [PATCH] Fixed SD2-1646 - "Run to cursor" is broken git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5568 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Debugger.AddIn/Service/RunToCursorCommand.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/AddIns/Debugger/Debugger.AddIn/Service/RunToCursorCommand.cs b/src/AddIns/Debugger/Debugger.AddIn/Service/RunToCursorCommand.cs index 87aae0c311..adf1b99c92 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Service/RunToCursorCommand.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Service/RunToCursorCommand.cs @@ -26,8 +26,17 @@ namespace ICSharpCode.SharpDevelop.Services ITextEditor textEditor = provider.TextEditor; Breakpoint breakpoint = winDebugger.DebuggerCore.Breakpoints.Add(textEditor.FileName, null, textEditor.Caret.Line, textEditor.Caret.Column, true); - breakpoint.Hit += delegate { breakpoint.Remove(); }; - winDebugger.DebuggedProcess.Paused += delegate { breakpoint.Remove(); }; + // Be careful to remove the breakpoint just once + breakpoint.Hit += delegate { + if (breakpoint != null) + breakpoint.Remove(); + breakpoint = null; + }; + winDebugger.DebuggedProcess.Paused += delegate { + if (breakpoint != null) + breakpoint.Remove(); + breakpoint = null; + }; if (!winDebugger.IsProcessRunning) { winDebugger.Continue(); }