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:58:11 -0500 |
commit | 2ad876ae4dac2ffa6d388fc8bc9d1f4e5e276cc7 (patch) | |
tree | 122ca880806a5ee39c69bcc740275dfb0e910653 /sc | |
parent | 17fe34ec569f3e14f35f3958cc5885a00bd6cff9 (diff) |
Use a copy; the container gets modified during iteration.
Diffstat (limited to 'sc')
-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 |