diff options
author | Eike Rathke <erack@redhat.com> | 2015-07-10 22:04:04 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-08-06 12:56:06 +0200 |
commit | fc3a8fe2c1dd9264c0a79290b4a2c526f536dfdf (patch) | |
tree | 0085f19610c3fe70a8a4d8d3d384c30cce9b3672 /vcl/unx/gtk3 | |
parent | 4e558ac10eac6354cfe3ec4b14d2a7051b04facd (diff) |
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 6a6b91da20e936abcc9f527f69aff48d2c23a94e)
Reviewed-on: https://gerrit.libreoffice.org/16937
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx/gtk3')
-rw-r--r-- | vcl/unx/gtk3/app/gtk3gtkinst.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/vcl/unx/gtk3/app/gtk3gtkinst.cxx b/vcl/unx/gtk3/app/gtk3gtkinst.cxx index 2dedd2de8bb7..41708923cc2d 100644 --- a/vcl/unx/gtk3/app/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/app/gtk3gtkinst.cxx @@ -112,9 +112,10 @@ public: GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); if (rFlavor.MimeType == "text/plain;charset=utf-16") { + OUString aStr; gchar *pText = gtk_clipboard_wait_for_text(clipboard); - OUString aStr(pText, rtl_str_getLength(pText), - RTL_TEXTENCODING_UTF8); + if (pText) + aStr = OUString(pText, rtl_str_getLength(pText), RTL_TEXTENCODING_UTF8); g_free(pText); css::uno::Any aRet; aRet <<= aStr.replaceAll("\r\n", "\n"); |