Completed
Last Updated: 03 Aug 2017 08:41 by ADMIN
ADMIN
Tanya
Created on: 10 Jul 2017 11:32
Category: RichTextBox
Type: Bug Report
0
RichTextBox: Memory leak when changing the document in Flow layout mode
When the document instance is changed (setting RadRichTextBox.Document property to new RadDocument instance), the old document is not released from the memory. There are UI providers, which are not properly removed from the layer's collection.

The issue is regression, introduced in R3 2016.

Workaround 1: Subscribe to DocumentChanging and set the layout mode of RadRichTextBox to Paged. Reset it back to Flow on DocumentChanged.

void radRichTextBox_DocumentChanged(object sender, EventArgs e)
{
    this.radRichTextBox.LayoutMode = DocumentLayoutMode.Flow;
}

void radRichTextBox_DocumentChanging(object sender, EventArgs e)
{
    this.radRichTextBox.LayoutMode = DocumentLayoutMode.Paged;
}

Workaround 2: Remove the WatermarkUILayer. You can achieve that by creating a custom UILayersBuilder. For more information on this approach, check the help article at http://docs.telerik.com/devtools/wpf/controls/radrichtextbox/how-to/features-custom-ui-layers

protected override void BuildUILayersOverride(Telerik.Windows.Documents.UI.IUILayerContainer uiLayerContainer)
{
    base.BuildUILayersOverride(uiLayerContainer);
    uiLayerContainer.UILayers.Remove(DefaultUILayers.WatermarkLayer);
}

Fix available in LIB Version 2017.2.724.
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments