Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Krüger <mkrueger@xamarin.com>2013-08-13 18:41:40 +0400
committerMike Krüger <mkrueger@xamarin.com>2013-08-13 18:41:40 +0400
commita9d0d37aff2d888182bdb3b211c865a134aaf616 (patch)
tree4fef33352395321709cf40ef3a6ef8139892d4ea /main/src/core/Mono.Texteditor
parent4835bc2f1bcd07de5562ea66824a5e812d11b235 (diff)
[TextEditor] Ensure that uncached layout wrappers are disposed.
Diffstat (limited to 'main/src/core/Mono.Texteditor')
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs13
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs13
2 files changed, 17 insertions, 9 deletions
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs
index a8ccb56f8d..42cb66d82d 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs
@@ -1737,8 +1737,11 @@ namespace Mono.TextEditor
var line = Document.GetLine (logicalLineNumber);
// Ensure that the correct line height is set.
- if (line != null)
- textViewMargin.GetLayout (line);
+ if (line != null) {
+ var wrapper = textViewMargin.GetLayout (line);
+ if (wrapper.IsUncached)
+ wrapper.Dispose ();
+ }
double lineHeight = GetLineHeight (line);
foreach (var margin in this.margins) {
@@ -2809,8 +2812,10 @@ namespace Mono.TextEditor
longest = line;
}
if (longest != longestLine) {
- int width = (int)(textViewMargin.GetLayout (longest).Width);
-
+ var layoutWrapper = textViewMargin.GetLayout (longest);
+ int width = (int)(layoutWrapper.Width);
+ if (layoutWrapper.IsUncached)
+ layoutWrapper.Dispose ();
if (width > this.longestLineWidth) {
this.longestLineWidth = width;
this.longestLine = longest;
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
index 78405ffc50..89dfe8469d 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
@@ -2752,11 +2752,11 @@ namespace Mono.TextEditor
lineArea = new Cairo.Rectangle (x2, lineArea.Y, textEditor.Allocation.Width - lineArea.X, lineArea.Height);
}
}
-
+ LayoutWrapper wrapper = null;
if (!isSelectionDrawn && BackgroundRenderer == null) {
if (isEolSelected) {
// prevent "gaps" in the selection drawing ('fuzzy' lines problem)
- LayoutWrapper wrapper = GetLayout (line);
+ wrapper = GetLayout (line);
var eolStartX = System.Math.Floor (position);
lineArea = new Cairo.Rectangle (
eolStartX,
@@ -2765,9 +2765,9 @@ namespace Mono.TextEditor
LineHeight);
DrawRectangleWithRuler (cr, x, lineArea, this.SelectionColor.Background, false);
if (line.Length == 0)
- DrawIndent (cr, GetLayout (line), line, lx, y);
+ DrawIndent (cr, wrapper, line, lx, y);
} else if (!(HighlightCaretLine || textEditor.Options.HighlightCaretLine) || Caret.Line != lineNr) {
- LayoutWrapper wrapper = GetLayout (line);
+ wrapper = GetLayout (line);
if (wrapper.EolSpanStack != null) {
foreach (var span in wrapper.EolSpanStack) {
var spanStyle = textEditor.ColorStyle.GetChunkStyle (span.Color);
@@ -2788,7 +2788,8 @@ namespace Mono.TextEditor
if (textEditor.Options.ShowWhitespaces != ShowWhitespaces.Never) {
if (!isEolFolded && isEolSelected || textEditor.Options.ShowWhitespaces == ShowWhitespaces.Always)
if (!(BackgroundRenderer != null && textEditor.Options.ShowWhitespaces == ShowWhitespaces.Selection)) {
- LayoutWrapper wrapper = GetLayout (line);
+ if (wrapper == null)
+ wrapper = GetLayout (line);
DrawEolMarker (cr, line, isEolSelected, position, y + System.Math.Max (0, wrapper.Height - LineHeight));
}
}
@@ -2818,6 +2819,8 @@ namespace Mono.TextEditor
cr.Stroke ();
}
}
+ if (wrapper != null && wrapper.IsUncached)
+ wrapper.Dispose ();
}
static double[] verticalShadowAlphaTable = new [] { 0.71, 0.84, 0.95 };