diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-01-13 11:56:35 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-01-13 11:57:38 -0500 |
commit | 54731b6a25ea7f049a866e9a3c78d0684f7e1bc4 (patch) | |
tree | e3724aa5247d2f09c3aa90e5b8ddf84bcae54588 | |
parent | 405cd1b404faaed034b1188806a0f7f3ff899664 (diff) |
Use a copy; the container gets modified during iteration.
-rw-r--r-- | sc/source/core/data/dptablecache.cxx | 7 |
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 |