[Libreoffice-commits] .: sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Fri Jan 13 08:57:48 PST 2012
sc/source/core/data/dptablecache.cxx | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 2ad876ae4dac2ffa6d388fc8bc9d1f4e5e276cc7
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Fri Jan 13 11:56:35 2012 -0500
Use a copy; the container gets modified during iteration.
diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx
index 1baec31..a65785b 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
More information about the Libreoffice-commits
mailing list