[Libreoffice-commits] core.git: sc/source
David Tardon
dtardon at redhat.com
Mon Aug 5 00:13:43 PDT 2013
sc/source/core/data/documentimport.cxx | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
New commits:
commit 95d1b05430d0d6384c6910fa9dfdd3c703201d34
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.
Change-Id: Icf3f02ecd2fe4ce6dd77f3cde226d32beb4d4b3f
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index bfda2f5..1c368b4 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -294,11 +294,21 @@ 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 sc::CellStoreType::value_type& node)
{
@@ -308,14 +318,14 @@ public:
// Fill with default values for non-empty cell segments.
sc::CellTextAttr aDefault;
if (node.type == sc::element_type_numeric)
- aDefault.mnScriptType = mnScriptNumeric;
+ aDefault.mnScriptType = mpImpl->mnScriptNumeric;
std::vector<sc::CellTextAttr> aDefaults(node.size, aDefault);
- miPos = maAttrs.set(miPos, node.position, aDefaults.begin(), aDefaults.end());
+ mpImpl->miPos = mpImpl->maAttrs.set(mpImpl->miPos, node.position, aDefaults.begin(), aDefaults.end());
}
void swap(sc::CellTextAttrStoreType& rAttrs)
{
- maAttrs.swap(rAttrs);
+ mpImpl->maAttrs.swap(rAttrs);
}
};
More information about the Libreoffice-commits
mailing list