From 94473174f14b41ce4fabaaeceb437d8b240d6e8d Mon Sep 17 00:00:00 2001 From: Monte Goulding Date: Mon, 3 Sep 2018 16:08:40 +1000 Subject: [PATCH] [[ Bug 21532 ]] Move clear before creation of clipboard item This patch moves the call to clear the raw clipboard if it has external data to before the creation of a new item so that any references to the new item are not cleared from the clipboard. --- engine/src/clipboard.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/src/clipboard.cpp b/engine/src/clipboard.cpp index 0b7aa1a5b94..fdb29a4d413 100644 --- a/engine/src/clipboard.cpp +++ b/engine/src/clipboard.cpp @@ -254,6 +254,10 @@ bool MCClipboard::AddText(MCStringRef p_string) AutoLock t_lock(this); + // Clear contents if the clipboard contains external data + if (m_clipboard->IsExternalData()) + Clear(); + // Clear contents to ensure that the clipboard does not end up // containing data from different copy events. // i.e. the HTML/RTF representation would be left untouched @@ -274,10 +278,6 @@ bool MCClipboard::AddTextToItem(MCRawClipboardItem* p_item, MCStringRef p_string { AutoLock t_lock(this); - // Clear contents if the clipboard contains external data - if (m_clipboard->IsExternalData()) - Clear(); - // For each text encoding that the underlying clipboard supports, encode the // text and add it. bool t_success = true;