summaryrefslogtreecommitdiffstats
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@suse.com>2012-01-13 11:56:35 -0500
committerKohei Yoshida <kohei.yoshida@suse.com>2012-01-13 11:58:11 -0500
commit2ad876ae4dac2ffa6d388fc8bc9d1f4e5e276cc7 (patch)
tree122ca880806a5ee39c69bcc740275dfb0e910653 /sc
parenthere calc, take ownership of this foul monstrosity only you use (diff)
downloadcore-2ad876ae4dac2ffa6d388fc8bc9d1f4e5e276cc7.tar.gz
core-2ad876ae4dac2ffa6d388fc8bc9d1f4e5e276cc7.zip
Use a copy; the container gets modified during iteration.
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/dptablecache.cxx7
1 files changed, 5 insertions, 2 deletions
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<ScDPObject*, void>
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