void RemoveDebugMarkers () { if (currentDebugLineMarker != null) { currentDebugLineMarker.Remove (); currentDebugLineMarker = null; } if (debugStackLineMarker != null) { debugStackLineMarker.Remove (); debugStackLineMarker = null; } }
public override void Dispose () { if (isDisposed) return; isDisposed = true; CancelMessageBubbleUpdate (); ClearExtensions (); FileRegistry.Remove (this); StoreSettings (); Counters.LoadedEditors--; /* if (messageBubbleHighlightPopupWindow != null) messageBubbleHighlightPopupWindow.Destroy ();*/ IdeApp.Preferences.DefaultHideMessageBubbles.Changed -= HandleIdeAppPreferencesDefaultHideMessageBubblesChanged; IdeApp.Preferences.ShowMessageBubbles.Changed -= HandleIdeAppPreferencesShowMessageBubblesChanged; TaskService.TaskToggled -= HandleErrorListPadTaskToggled; DisposeErrorMarkers (); ClipbardRingUpdated -= UpdateClipboardRing; widget.TextEditor.Document.TextReplaced -= HandleTextReplaced; widget.TextEditor.Document.LineChanged -= HandleLineChanged; widget.TextEditor.Document.BeginUndo -= HandleBeginUndo; widget.TextEditor.Document.EndUndo -= HandleEndUndo; widget.TextEditor.Caret.PositionChanged -= HandlePositionChanged; widget.TextEditor.IconMargin.ButtonPressed -= OnIconButtonPress; widget.TextEditor.Document.TextReplacing -= OnTextReplacing; widget.TextEditor.Document.TextReplaced -= OnTextReplaced; widget.TextEditor.Document.ReadOnlyCheckDelegate = null; widget.TextEditor.Options.Changed -= HandleWidgetTextEditorOptionsChanged; widget.TextEditor.TextViewMargin.LineShown -= TextViewMargin_LineShown; TextEditorService.FileExtensionAdded -= HandleFileExtensionAdded; TextEditorService.FileExtensionRemoved -= HandleFileExtensionRemoved; DebuggingService.ExecutionLocationChanged -= OnExecutionLocationChanged; DebuggingService.DebugSessionStarted -= OnDebugSessionStarted; DebuggingService.StoppedEvent -= HandleTargetExited; DebuggingService.CurrentFrameChanged -= OnCurrentFrameChanged; DebuggingService.StoppedEvent -= OnCurrentFrameChanged; DebuggingService.ResumedEvent -= OnCurrentFrameChanged; breakpoints.BreakpointAdded -= OnBreakpointAdded; breakpoints.BreakpointRemoved -= OnBreakpointRemoved; breakpoints.BreakpointStatusChanged -= OnBreakpointStatusChanged; breakpoints.BreakpointModified -= OnBreakpointStatusChanged; DebuggingService.PinnedWatches.WatchAdded -= OnWatchAdded; DebuggingService.PinnedWatches.WatchRemoved -= OnWatchRemoved; DebuggingService.PinnedWatches.WatchChanged -= OnWatchChanged; TaskService.Errors.TasksAdded -= UpdateTasks; TaskService.Errors.TasksRemoved -= UpdateTasks; TaskService.Errors.TasksChanged -= UpdateTasks; TaskService.JumpedToTask -= HandleTaskServiceJumpedToTask; // This is not necessary but helps when tracking down memory leaks debugStackLineMarker = null; currentDebugLineMarker = null; RemoveMarkerQueue (); widget.Dispose (); if (wrapper != null) { wrapper.Dispose (); wrapper = null; } this.Project = null; }
void UpdateExecutionLocation () { if (currentDebugLineMarker != null || debugStackLineMarker != null) { RemoveDebugMarkers (); widget.TextEditor.QueueDraw (); } if (DebuggingService.IsPaused) { var location = CheckLocationIsInFile (DebuggingService.NextStatementLocation) ?? CheckFrameIsInFile (DebuggingService.CurrentFrame) ?? CheckFrameIsInFile (DebuggingService.GetCurrentVisibleFrame ()); if (location != null) { RemoveDebugMarkers (); var segment = widget.TextEditor.Document.GetLine (location.Line); if (segment != null) { int offset, length; if (location.Line > 0 && location.Column > 0 && location.EndLine > 0 && location.EndColumn > 0) { offset = widget.TextEditor.LocationToOffset (location.Line, location.Column); length = widget.TextEditor.LocationToOffset (location.EndLine, location.EndColumn) - offset; } else { offset = segment.Offset; length = segment.Length; } if (DebuggingService.CurrentFrameIndex == 0) { currentDebugLineMarker = new CurrentDebugLineTextMarker (widget.TextEditor, offset, length); currentDebugLineMarker.AddTo (widget.TextEditor.Document, segment); } else { debugStackLineMarker = new DebugStackLineTextMarker (widget.TextEditor, offset, length); debugStackLineMarker.AddTo (widget.TextEditor.Document, segment); } widget.TextEditor.QueueDraw (); } return; } } }