diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-07 13:14:57 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-11 16:17:27 -0500 |
commit | fd50b465b94203e9980368481c579178cf93483a (patch) | |
tree | 6ea11359c5109cb597daea6c15a6a0c1adcfc652 /sc/source/core/data | |
parent | 82d6b0c64698e356a950d9b516ca5332817b71a3 (diff) |
Guard access to external ref manager instance.
Change-Id: Ie3208844b523463954c482d080f02d726ae749f9
Diffstat (limited to 'sc/source/core/data')
-rw-r--r-- | sc/source/core/data/documen2.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/documen3.cxx | 27 |
2 files changed, 21 insertions, 10 deletions
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 23a4bcfe4012..846b5c80fe99 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -150,7 +150,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) : pCacheFieldEditEngine( NULL ), pDocProtection( NULL ), mpClipParam( NULL), - pExternalRefMgr( NULL ), + mpExternalRefMgr( NULL ), mpMacroMgr( NULL ), pViewOptions( NULL ), pDocOptions( NULL ), @@ -384,7 +384,7 @@ ScDocument::~ScDocument() mxFormulaParserPool.reset(); // Destroy the external ref mgr instance here because it has a timer // which needs to be stopped before the app closes. - pExternalRefMgr.reset(); + mpExternalRefMgr.reset(); ScAddInAsync::RemoveDocument( this ); ScAddInListener::RemoveDocument( this ); diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 73f8d71598f8..67fda15f3a33 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -582,30 +582,41 @@ bool ScDocument::LinkExternalTab( SCTAB& rTab, const OUString& aDocTab, return true; } +bool ScDocument::HasExternalRefManager() const +{ + osl::MutexGuard aGuard(&maMtxExternalRefMgr); + return mpExternalRefMgr.get(); +} + ScExternalRefManager* ScDocument::GetExternalRefManager() const { + osl::MutexGuard aGuard(&maMtxExternalRefMgr); + ScDocument* pThis = const_cast<ScDocument*>(this); - if (!pExternalRefMgr.get()) - pThis->pExternalRefMgr.reset( new ScExternalRefManager( pThis)); + if (!mpExternalRefMgr.get()) + pThis->mpExternalRefMgr.reset( new ScExternalRefManager( pThis)); - return pExternalRefMgr.get(); + return mpExternalRefMgr.get(); } bool ScDocument::IsInExternalReferenceMarking() const { - return pExternalRefMgr.get() && pExternalRefMgr->isInReferenceMarking(); + osl::MutexGuard aGuard(&maMtxExternalRefMgr); + return mpExternalRefMgr.get() && mpExternalRefMgr->isInReferenceMarking(); } void ScDocument::MarkUsedExternalReferences() { - if (!pExternalRefMgr.get()) + osl::MutexGuard aGuard(&maMtxExternalRefMgr); + + if (!mpExternalRefMgr.get()) return; - if (!pExternalRefMgr->hasExternalData()) + if (!mpExternalRefMgr->hasExternalData()) return; // Charts. - pExternalRefMgr->markUsedByLinkListeners(); + mpExternalRefMgr->markUsedByLinkListeners(); // Formula cells. - pExternalRefMgr->markUsedExternalRefCells(); + mpExternalRefMgr->markUsedExternalRefCells(); /* NOTE: Conditional formats and validation objects are marked when * collecting them during export. */ |