summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-04-02 11:45:13 +0200
committerCaolán McNamara <caolanm@redhat.com>2015-04-03 07:26:08 +0000
commit5eafe30b41c9445b16b2cfe08ac4eb8a9cb3ccb1 (patch)
treed08d2d59beb7c389e3e7c820201cc87d3d42bea7
parentadd86b9d5fcf3cb52549e64be148ba9e7bb4005e (diff)
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 (cherry picked from commit 5ece3e3525b0ef62e1b0e59ac5446aec0538d0d3) Reviewed-on: https://gerrit.libreoffice.org/15117 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--editeng/source/editeng/editobj.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index 332e71ecd367..350e0d9537ba 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -978,11 +978,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");
+ }
}
}
}