summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-12-01 19:25:13 +0100
committerMichael Stahl <mstahl@redhat.com>2014-12-01 23:12:56 +0100
commit7a242b463132d67a4a2d6e69319e0da367145cc0 (patch)
tree5dc3962f8eaa364530591ea106d2de04d4e5aabb
parent846b56b6b99e334dfa44f1a24640aa3158509854 (diff)
fdo#85496: add some asserts to detect this sort of problem
Change-Id: Iff787c8d2a71bc3082192cc98e3d916badee65dd
-rw-r--r--editeng/source/editeng/editobj.cxx5
-rw-r--r--xmloff/source/style/impastpl.cxx14
2 files changed, 19 insertions, 0 deletions
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index 11e1b22cb7fc..bf316c71b2fe 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -992,6 +992,11 @@ void EditTextObjectImpl::GetAllSections( std::vector<editeng::Section>& rAttrs )
for (; itCurAttr != aAttrs.end() && itCurAttr->mnParagraph == nPara && itCurAttr->mnEnd <= nEnd; ++itCurAttr)
{
editeng::Section& rSecAttr = *itCurAttr;
+ // serious bug: will cause duplicate attributes to be exported
+ assert(rSecAttr.maAttributes.end() == std::find_if(
+ rSecAttr.maAttributes.begin(), rSecAttr.maAttributes.end(),
+ [&pItem](SfxPoolItem const*const pIt)
+ { return pIt->Which() == pItem->Which(); }));
rSecAttr.maAttributes.push_back(pItem);
}
}
diff --git a/xmloff/source/style/impastpl.cxx b/xmloff/source/style/impastpl.cxx
index 1888407d2e10..365fd5e2c5c9 100644
--- a/xmloff/source/style/impastpl.cxx
+++ b/xmloff/source/style/impastpl.cxx
@@ -247,6 +247,20 @@ XMLAutoStylePoolProperties::XMLAutoStylePoolProperties( XMLAutoStyleFamily& rFam
}
while (rFamilyData.maNameSet.find(msName) != rFamilyData.maNameSet.end());
}
+
+#if OSL_DEBUG_LEVEL > 0
+ std::set<sal_Int32> DebugProperties;
+ for (size_t i = 0; i < maProperties.size(); ++i)
+ {
+ sal_Int32 const property(maProperties[i].mnIndex);
+ // serious bug: will cause duplicate attributes to be exported
+ assert(DebugProperties.find(property) == DebugProperties.end());
+ if (-1 != property)
+ {
+ DebugProperties.insert(property);
+ }
+ }
+#endif
}
bool operator<( const XMLAutoStyleFamily& r1, const XMLAutoStyleFamily& r2)