[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - vcl/unx

Caolán McNamara caolanm at redhat.com
Thu Apr 26 14:18:46 UTC 2018


 vcl/unx/gtk/gtksalframe.cxx   |   10 ++++++++--
 vcl/unx/gtk3/gtk3gtkframe.cxx |   10 ++++++++--
 2 files changed, 16 insertions(+), 4 deletions(-)

New commits:
commit f7d8a6ffae387a2698b07a8841e09ca3ed0bb000
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Apr 19 20:12:40 2018 +0100

    Resolves: tdf#116951 rhbz#1569331 start is G_MAXINT
    
    and text is nullptr, seeing as an end G_MAXINT translates to str len,
    assume the same for start
    
    Reviewed-on: https://gerrit.libreoffice.org/53376
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>
    (cherry picked from commit 697ebd15d646e41bb69726f7b438ebbfaff141b0)
    
    Related: tdf#116951 rhbz#1569331 end should be in terms of unicode chars
    
    not bytes
    
    Reviewed-on: https://gerrit.libreoffice.org/53175
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit d4a01820ae094ef2d4ec2196334120600b1c9621)
    
    Change-Id: I05114019abb6c283586cd5c23ed1d148c9cf71d3
    Reviewed-on: https://gerrit.libreoffice.org/53176
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index ff540dc8fd1d..d57ec7162d69 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -3650,8 +3650,14 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_
         ExtTextInputAttr sal_attr = ExtTextInputAttr::NONE;
 
         pango_attr_iterator_range (iter, &start, &end);
-        if (end == G_MAXINT)
-            end = pText ? strlen (pText) : 0;
+        if (start == G_MAXINT || end == G_MAXINT)
+        {
+            auto len = pText ? g_utf8_strlen(pText, -1) : 0;
+            if (end == G_MAXINT)
+                end = len;
+            if (start == G_MAXINT)
+                start = len;
+        }
         if (end == start)
             continue;
 
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index c8c98f5c5255..40e1d1412d6a 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -4006,8 +4006,14 @@ void GtkSalFrame::IMHandler::signalIMPreeditChanged( GtkIMContext*, gpointer im_
         ExtTextInputAttr sal_attr = ExtTextInputAttr::NONE;
 
         pango_attr_iterator_range (iter, &start, &end);
-        if (end == G_MAXINT)
-            end = pText ? strlen (pText) : 0;
+        if (start == G_MAXINT || end == G_MAXINT)
+        {
+            auto len = pText ? g_utf8_strlen(pText, -1) : 0;
+            if (end == G_MAXINT)
+                end = len;
+            if (start == G_MAXINT)
+                start = len;
+        }
         if (end == start)
             continue;
 


More information about the Libreoffice-commits mailing list