Kaydet (Commit) 2ad876ae authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Use a copy; the container gets modified during iteration.

üst 17fe34ec
...@@ -447,8 +447,11 @@ struct ClearObjectSource : std::unary_function<ScDPObject*, void> ...@@ -447,8 +447,11 @@ struct ClearObjectSource : std::unary_function<ScDPObject*, void>
ScDPCache::~ScDPCache() ScDPCache::~ScDPCache()
{ {
// Make sure no live ScDPObject instances hold reference to this cache any more. // Make sure no live ScDPObject instances hold reference to this cache any
std::for_each(maRefObjects.begin(), maRefObjects.end(), ClearObjectSource()); // 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 bool ScDPCache::IsValid() const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment