diff options
2 files changed, 5 insertions, 2 deletions
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.IdleUpdater.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.IdleUpdater.cs index 4cd379f151..f0efd85c90 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.IdleUpdater.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.IdleUpdater.cs @@ -119,7 +119,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks bool RunHandler () { tokenExit: - if (token.IsCancellationRequested || mode.TextEditor.GetTextEditorData () == null) { + if (token.IsCancellationRequested || mode.TextEditor.GetTextEditorData () == null || surface.IsDisposed) { cr.Dispose (); // if the surface was newly created dispose it otherwise it'll leak. if (surface != mode.swapIndicatorSurface) @@ -197,7 +197,8 @@ namespace MonoDevelop.SourceEditor.QuickTasks drawingStep++; return true; default: - mode.DrawBreakpoints (cr); + if (cr.Handle != IntPtr.Zero) + mode.DrawBreakpoints (cr); cr.Dispose (); var tmp = mode.indicatorSurface; mode.indicatorSurface = surface; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/CairoExtensions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/CairoExtensions.cs index ae8a207e98..e92fe4c229 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/CairoExtensions.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/CairoExtensions.cs @@ -612,6 +612,7 @@ namespace MonoDevelop.Components public int Width { get; private set; } public int Height { get; private set; } public object Data { get; set; } + public bool IsDisposed { get; private set; } public SurfaceWrapper (Cairo.Context similar, int width, int height) { @@ -654,6 +655,7 @@ namespace MonoDevelop.Components public void Dispose () { + IsDisposed = true; if (Surface != null) { ((IDisposable)Surface).Dispose (); } |