writerfilter/source/ooxml/OOXMLPropertySet.cxx |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

New commits:
commit a3c2cce616c3a072ed7f7f8133b88db165ccbc5c
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Fri Sep 29 10:37:38 2017 +0200

    Revert "writerfilter: convert loops to range-based-for"
    
    This reverts commit 25cd067a82742210793e39708cc1de9ff84692a7, as it
    broke CppunitTest_sw_ooxmlexport4. The comment above the change suggests
    that perhaps the usage of indexes was intentional to avoid the usage of
    invalidated iterators.

diff --git a/writerfilter/source/ooxml/OOXMLPropertySet.cxx 
b/writerfilter/source/ooxml/OOXMLPropertySet.cxx
index d4b7d1284af7..bd80f8dc5112 100644
--- a/writerfilter/source/ooxml/OOXMLPropertySet.cxx
+++ b/writerfilter/source/ooxml/OOXMLPropertySet.cxx
@@ -329,8 +329,8 @@ OOXMLValue * OOXMLInputStreamValue::clone() const
 */
 
 OOXMLPropertySet::OOXMLPropertySet()
-    : maType("OOXMLPropertySet")
 {
+    maType = "OOXMLPropertySet";
 }
 
 OOXMLPropertySet::~OOXMLPropertySet()
@@ -343,8 +343,10 @@ void OOXMLPropertySet::resolve(Properties & rHandler)
     // be appended to mProperties. I don't think it can cause elements
     // to be deleted. But let's check with < here just to be safe that
     // the indexing below works.
-    for (OOXMLProperty::Pointer_t & pProp : mProperties)
+    for (size_t nIt = 0; nIt < mProperties.size(); ++nIt)
     {
+        OOXMLProperty::Pointer_t pProp = mProperties[nIt];
+
         if (pProp.get() != nullptr)
             pProp->resolve(rHandler);
     }
@@ -745,17 +747,23 @@ OOXMLTable::~OOXMLTable()
 
 void OOXMLTable::resolve(Table & rTable)
 {
+    Table * pTable = &rTable;
+
     int nPos = 0;
 
-    for (const ValuePointer_t & it : mPropertySets)
+    PropertySets_t::iterator it = mPropertySets.begin();
+    PropertySets_t::iterator itEnd = mPropertySets.end();
+
+    while (it != itEnd)
     {
         writerfilter::Reference<Properties>::Pointer_t pProperties
-            (it->getProperties());
+            ((*it)->getProperties());
 
         if (pProperties.get() != nullptr)
-            rTable.entry(nPos, pProperties);
+            pTable->entry(nPos, pProperties);
 
         ++nPos;
+        ++it;
     }
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to