diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-01-13 13:56:34 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-01-13 13:57:44 -0500 |
commit | e60b212cc9f02d68ee638106a5881c21ac40ce8d (patch) | |
tree | 900fb0089fbf3d3d93090d8800da31ec260d04f8 /sc | |
parent | scp2: install nsplugin only in case it's build (diff) | |
download | core-e60b212cc9f02d68ee638106a5881c21ac40ce8d.tar.gz core-e60b212cc9f02d68ee638106a5881c21ac40ce8d.zip |
Avoid double deletion during data cache object destruction.
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/dptablecache.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/dptablecache.cxx | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/sc/inc/dptablecache.hxx b/sc/inc/dptablecache.hxx index 882f42293064..dcfc066e29de 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 a65785bdc57d..ed45647a191b 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); |