Kaydet (Commit) e728c26e authored tarafından Eike Rathke's avatar Eike Rathke Kaydeden (comit) Caolán McNamara

fix assert when pasting nil clipboard content

This happened when one of our modules had clipboard content and was
closed, which currently clears the clipboard, and then reopened and
attempting to paste the content. Apparently the utf-16 mime-type is
still alive but the content isn't, on which rtl_str_getLength(pText)
asserts.

Change-Id: I5cc7c20ac1f1a8551a10b033e1f37bf83c5cc202
(cherry picked from commit 6a6b91da)
Reviewed-on: https://gerrit.libreoffice.org/16937Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 86deb192
...@@ -112,9 +112,10 @@ public: ...@@ -112,9 +112,10 @@ public:
GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
if (rFlavor.MimeType == "text/plain;charset=utf-16") if (rFlavor.MimeType == "text/plain;charset=utf-16")
{ {
OUString aStr;
gchar *pText = gtk_clipboard_wait_for_text(clipboard); gchar *pText = gtk_clipboard_wait_for_text(clipboard);
OUString aStr(pText, rtl_str_getLength(pText), if (pText)
RTL_TEXTENCODING_UTF8); aStr = OUString(pText, rtl_str_getLength(pText), RTL_TEXTENCODING_UTF8);
g_free(pText); g_free(pText);
css::uno::Any aRet; css::uno::Any aRet;
aRet <<= aStr.replaceAll("\r\n", "\n"); aRet <<= aStr.replaceAll("\r\n", "\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment