[libreoffice] Resolves: fdo#37584 Make a real copy of the text

Caolan McNamara caolanm at fedoraproject.org
Wed Jun 8 12:53:54 UTC 2011


commit e4e022c652ad4a2ef7ae291dc3bfed8c537a2328
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jun 8 13:53:41 2011 +0100

    Resolves: fdo#37584 Make a real copy of the text

 ...ake-a-real-copy-of-the-text-where-to-coun.patch |   35 ++++++++++++++++++++
 libreoffice.spec                                   |    3 ++
 2 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/0001-fdo-37584-Make-a-real-copy-of-the-text-where-to-coun.patch b/0001-fdo-37584-Make-a-real-copy-of-the-text-where-to-coun.patch
new file mode 100644
index 0000000..0f9d8ba
--- /dev/null
+++ b/0001-fdo-37584-Make-a-real-copy-of-the-text-where-to-coun.patch
@@ -0,0 +1,35 @@
+From 73a9de430716486d4bd7d535df257fb50889a12b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= <cedric.bosdonnat.ooo at free.fr>
+Date: Wed, 8 Jun 2011 10:06:23 +0200
+Subject: [PATCH] fdo#37584: Make a real copy of the text where to count words
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Const-casting a reference doesn't create a copy of it and then the
+spaces replacement made by the WordCount was also made on the actual
+text node. Use String::Copy() to actually copy the text and safely
+operate on it.
+(cherry picked from commit 135cf4fdbec71e8d93edc0339e8617d50766f151)
+
+Signed-off-by: Caolán McNamara <caolanm at redhat.com>
+---
+ sw/source/core/txtnode/txtedt.cxx |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
+index d4c02b6..08d0c6b 100644
+--- a/sw/source/core/txtnode/txtedt.cxx
++++ b/sw/source/core/txtnode/txtedt.cxx
+@@ -1814,7 +1814,7 @@ void SwTxtNode::CountWords( SwDocStat& rStat,
+     }
+ 
+     // make a copy of the text
+-    String& rTextCopy = const_cast<String&>(m_Text);
++    String rTextCopy = m_Text.Copy( );
+ 
+     // mask out the redlined and hidden text with ' '
+     const xub_Unicode cChar(' ');
+-- 
+1.7.5.2
+
diff --git a/libreoffice.spec b/libreoffice.spec
index 1a91558..572784b 100644
--- a/libreoffice.spec
+++ b/libreoffice.spec
@@ -97,6 +97,7 @@ Patch18: 0001-Resolves-rhbz-710004-band-aid-for-immediate-crash-in.patch
 Patch19: 0001-Resolves-rhbz-710556-don-t-crash-on-missing-graphics.patch
 Patch20: 0001-Related-rhbz-652604-better-survive-exceptions-thrown.patch
 Patch21: 0001-Resolves-rhbz-699909-crash-in-export-of-.doc-in-lcl_.patch
+Patch22: 0001-fdo-37584-Make-a-real-copy-of-the-text-where-to-coun.patch
 
 %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
 %define instdir %{_libdir}
@@ -719,6 +720,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc
 %patch19 -p1 -b .rhbz710556-don-t-crash-on-missing-graphics.patch
 %patch20 -p1 -b .rhbz652604-better-survive-exceptions-thrown.patch
 %patch21 -p1 -b .rhbz699909-crash-in-export-of-.doc-in-lcl_.patch
+%patch22 -p1 -b .fdo37584-Make-a-real-copy-of-the-text-where-to-coun.patch
 
 # these are horribly incomplete--empty translations and copied english
 # strings with spattering of translated strings
@@ -2000,6 +2002,7 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
 %changelog
 * Wed Jun 08 2011 Caolán McNamara <caolanm at redhat.com> - 3.4.0.2-5
 - Resolves: rhbz#699909 crash in export of .doc in lcl_getField
+- Resolves: fdo#37584 Make a real copy of the text
 
 * Tue Jun 07 2011 Caolán McNamara <caolanm at redhat.com> - 3.4.0.2-4
 - Resolves: rhbz#710556 't crash on missing graphics .pptx export


More information about the scm-commits mailing list