From 2ad876ae4dac2ffa6d388fc8bc9d1f4e5e276cc7 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Fri, 13 Jan 2012 11:56:35 -0500 Subject: Use a copy; the container gets modified during iteration. --- sc/source/core/data/dptablecache.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sc') diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx index 1baec319146e..a65785bdc57d 100644 --- a/sc/source/core/data/dptablecache.cxx +++ b/sc/source/core/data/dptablecache.cxx @@ -447,8 +447,11 @@ struct ClearObjectSource : std::unary_function ScDPCache::~ScDPCache() { - // Make sure no live ScDPObject instances hold reference to this cache any more. - std::for_each(maRefObjects.begin(), maRefObjects.end(), ClearObjectSource()); + // Make sure no live ScDPObject instances hold reference to this cache any + // more. We need to use a copied set because the referencing objects will + // modify the original when clearing their source. + ObjectSetType aRefs(maRefObjects); + std::for_each(aRefs.begin(), aRefs.end(), ClearObjectSource()); } bool ScDPCache::IsValid() const -- cgit