[Libreoffice-commits] core.git: editeng/source

Michael Stahl mstahl at redhat.com
Thu Apr 2 03:55:05 PDT 2015


 editeng/source/editeng/editobj.cxx |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 5ece3e3525b0ef62e1b0e59ac5446aec0538d0d3
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Apr 2 11:45:13 2015 +0200

    tdf#85496: editeng: suppress all duplicate attributes during export
    
    Since commit 0d57434180db6c8eda8c5b9b704f8a1c18b371df multiple 0-length
    attributes will be exported by the ODF filter as duplicate attributes.
    
    846b56b6b99e334dfa44f1a24640aa3158509854 was apparently not the only
    bug that could cause this; unfortunately nobody is able to reproduce
    the editing operations that result in the newly reported issue,
    so just take the safe approach and check for duplicates,
    as is already done in the libreoffice-4-3 and libreoffice-4-2 branches.
    
    Change-Id: I1de10a99f6b84a0f4ea793ad55aaf6953b8307d5

diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index ea20882..9751f32 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -993,11 +993,18 @@ void EditTextObjectImpl::GetAllSections( std::vector<editeng::Section>& rAttrs )
             {
                 editeng::Section& rSecAttr = *itCurAttr;
                 // serious bug: will cause duplicate attributes to be exported
-                assert(rSecAttr.maAttributes.end() == std::find_if(
+                auto iter(std::find_if(
                     rSecAttr.maAttributes.begin(), rSecAttr.maAttributes.end(),
                     [&pItem](SfxPoolItem const*const pIt)
                         { return pIt->Which() == pItem->Which(); }));
-                rSecAttr.maAttributes.push_back(pItem);
+                if (rSecAttr.maAttributes.end() == iter)
+                {
+                    rSecAttr.maAttributes.push_back(pItem);
+                }
+                else
+                {
+                    SAL_WARN("editeng", "GetAllSections(): duplicate attribute suppressed");
+                }
             }
         }
     }


More information about the Libreoffice-commits mailing list