[Libreoffice-commits] core.git: vcl/unx

Eike Rathke erack at redhat.com
Fri Jul 10 13:10:50 PDT 2015


 vcl/unx/gtk3/app/gtk3gtkinst.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 6a6b91da20e936abcc9f527f69aff48d2c23a94e
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Jul 10 22:04:04 2015 +0200

    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

diff --git a/vcl/unx/gtk3/app/gtk3gtkinst.cxx b/vcl/unx/gtk3/app/gtk3gtkinst.cxx
index 2dedd2d..41708923c 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");


More information about the Libreoffice-commits mailing list