sc/inc/dptablecache.hxx | 2 ++ sc/source/core/data/dptablecache.cxx | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-)
New commits: commit e60b212cc9f02d68ee638106a5881c21ac40ce8d Author: Kohei Yoshida <kohei.yosh...@suse.com> Date: Fri Jan 13 13:56:34 2012 -0500 Avoid double deletion during data cache object destruction. diff --git a/sc/inc/dptablecache.hxx b/sc/inc/dptablecache.hxx index 882f422..dcfc066 100644 --- a/sc/inc/dptablecache.hxx +++ b/sc/inc/dptablecache.hxx @@ -93,6 +93,8 @@ private: mutable ScDPItemDataPool maAdditionalData; + bool mbDisposing; + public: void AddReference(ScDPObject* pObj) const; void RemoveReference(ScDPObject* pObj) const; diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx index a65785b..ed45647 100644 --- a/sc/source/core/data/dptablecache.cxx +++ b/sc/source/core/data/dptablecache.cxx @@ -429,7 +429,8 @@ bool ScDPCache::operator== ( const ScDPCache& r ) const ScDPCache::ScDPCache(ScDocument* pDoc) : mpDoc( pDoc ), - mnColumnCount ( 0 ) + mnColumnCount ( 0 ), + mbDisposing(false) { } @@ -448,10 +449,9 @@ struct ClearObjectSource : std::unary_function<ScDPObject*, void> ScDPCache::~ScDPCache() { // 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()); + // more. + mbDisposing = true; + std::for_each(maRefObjects.begin(), maRefObjects.end(), ClearObjectSource()); } bool ScDPCache::IsValid() const @@ -1010,6 +1010,10 @@ void ScDPCache::AddReference(ScDPObject* pObj) const void ScDPCache::RemoveReference(ScDPObject* pObj) const { + if (mbDisposing) + // Object being deleted. + return; + maRefObjects.erase(pObj); if (maRefObjects.empty()) mpDoc->GetDPCollection()->RemoveCache(this); _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits