[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sc/source

David Tardon dtardon at redhat.com
Tue Aug 6 08:14:33 PDT 2013


 sc/source/core/data/documentimport.cxx |   24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

New commits:
commit 85a7606366b73d2adf03f685d2c3331a03f8fca0
Author: David Tardon <dtardon at redhat.com>
Date:   Mon Aug 5 09:09:00 2013 +0200

    fix build with debug STL
    
    Failed with:
    /usr/include/c++/4.8.1/debug/safe_iterator.h:510:error: attempt to compare
    iterators from different sequences.
    
    Objects involved in the operation:
    ...
    
    The problem is that miPos in _copied_ object points ot maAttrs in the
    original object, not in the copy (and std::for_each takes a copy of the
    functor). This could be solved by defining copy constructor and
    operator=, but given the limited usage of the class, it is simpler to
    let copies share the state.
    
    (cherry picked from commit 95d1b05430d0d6384c6910fa9dfdd3c703201d34)
    Conflicts:
    	sc/source/core/data/documentimport.cxx
    
    Change-Id: Icf3f02ecd2fe4ce6dd77f3cde226d32beb4d4b3f
    Signed-off-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index 7768716..0078db4 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -252,23 +252,33 @@ namespace {
 
 class CellTextAttrInitializer
 {
-    sc::CellTextAttrStoreType maAttrs;
-    sc::CellTextAttrStoreType::iterator miPos;
-    sal_uInt16 mnScriptNumeric;
+    struct Impl
+    {
+        sc::CellTextAttrStoreType maAttrs;
+        sc::CellTextAttrStoreType::iterator miPos;
+        sal_uInt16 mnScriptNumeric;
+
+        Impl(const sal_uInt32 nMaxRowCount, const sal_uInt16 nScriptNumeric)
+            : maAttrs(nMaxRowCount), miPos(maAttrs.begin()), mnScriptNumeric(nScriptNumeric)
+        {}
+    };
+
+    boost::shared_ptr<Impl> mpImpl;
+
 public:
-    CellTextAttrInitializer(sal_uInt16 nScriptNumeric) : maAttrs(MAXROWCOUNT), miPos(maAttrs.begin()), mnScriptNumeric(nScriptNumeric) {}
+    CellTextAttrInitializer(sal_uInt16 nScriptNumeric) : mpImpl(new Impl(MAXROWCOUNT, nScriptNumeric)) {}
 
     void operator() (const ColEntry& rEntry)
     {
         sc::CellTextAttr aDefault;
         if (rEntry.pCell->GetCellType() == CELLTYPE_VALUE)
-            aDefault.mnScriptType = mnScriptNumeric;
-        miPos = maAttrs.set(miPos, rEntry.nRow, aDefault);
+            aDefault.mnScriptType = mpImpl->mnScriptNumeric;
+        mpImpl->miPos = mpImpl->maAttrs.set(mpImpl->miPos, rEntry.nRow, aDefault);
     }
 
     void swap(sc::CellTextAttrStoreType& rAttrs)
     {
-        maAttrs.swap(rAttrs);
+        mpImpl->maAttrs.swap(rAttrs);
     }
 };
 


More information about the Libreoffice-commits mailing list