Unplanned
Last Updated: 06 Mar 2020 05:44 by ADMIN
Joshua
Created on: 17 Feb 2020 08:20
Category: RichTextBox
Type: Bug Report
2
ClipboardEx leaks RadRichTextBox instances

A reference in DocumentFragment to RadDocument (CopySource property) can cause a memory after copy-paste between RadDocument.

Workaround:

public static bool ReleaseClipboardExReferences(
    RadDocument document)
{
    dynamic clipboardEx = new DynamicProxyObject(typeof(ClipboardEx));

    if (clipboardEx.documentClipboardData?.CopySource is DynamicProxyObject copySource
        && object.ReferenceEquals(copySource.Instance, document))
    {
        clipboardEx.documentClipboardData = null;
        return true;
    }

    if (clipboardEx.CopiedDocumentFragment?.Fragment?.CopySource is DynamicProxyObject fragmentCopySource
        && object.ReferenceEquals(fragmentCopySource.Instance, document))
    {
        clipboardEx.CopiedDocumentFragment = null;
        return true;
    }

    return false;
}

0 comments