Kaydet (Commit) 6a6b91da authored tarafından Eike Rathke's avatar Eike Rathke

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
üst 871cd42b
...@@ -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