diff --git a/src/Avalonia.Controls/Presenters/TextPresenter.cs b/src/Avalonia.Controls/Presenters/TextPresenter.cs
index 480a8ee7a7..f599511392 100644
--- a/src/Avalonia.Controls/Presenters/TextPresenter.cs
+++ b/src/Avalonia.Controls/Presenters/TextPresenter.cs
@@ -588,6 +588,7 @@ namespace Avalonia.Controls.Presenters
protected virtual void InvalidateTextLayout()
{
+ _textLayout?.Dispose();
_textLayout = null;
InvalidateMeasure();
@@ -597,6 +598,7 @@ namespace Avalonia.Controls.Presenters
{
_constraint = availableSize;
+ _textLayout?.Dispose();
_textLayout = null;
InvalidateArrange();
@@ -622,6 +624,7 @@ namespace Avalonia.Controls.Presenters
_constraint = new Size(Math.Ceiling(finalSize.Width), double.PositiveInfinity);
+ _textLayout?.Dispose();
_textLayout = null;
return finalSize;
diff --git a/src/Avalonia.Controls/TextBlock.cs b/src/Avalonia.Controls/TextBlock.cs
index 7a0da1ecc5..31ddf1f985 100644
--- a/src/Avalonia.Controls/TextBlock.cs
+++ b/src/Avalonia.Controls/TextBlock.cs
@@ -173,13 +173,7 @@ namespace Avalonia.Controls
///
/// Gets the used to render the text.
///
- public TextLayout TextLayout
- {
- get
- {
- return _textLayout ??= CreateTextLayout(_text);
- }
- }
+ public TextLayout TextLayout => _textLayout ??= CreateTextLayout(_text);
///
/// Gets or sets the padding to place around the .
@@ -648,6 +642,7 @@ namespace Avalonia.Controls
///
protected void InvalidateTextLayout()
{
+ _textLayout?.Dispose();
_textLayout = null;
InvalidateVisual();
@@ -663,6 +658,7 @@ namespace Avalonia.Controls
_constraint = availableSize.Deflate(padding);
+ _textLayout?.Dispose();
_textLayout = null;
var inlines = Inlines;
@@ -726,6 +722,7 @@ namespace Avalonia.Controls
_constraint = new Size(Math.Ceiling(finalSize.Deflate(padding).Width), double.PositiveInfinity);
+ _textLayout?.Dispose();
_textLayout = null;
if (HasComplexContent)