diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-10-31 12:45:04 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-10-31 12:45:04 +0100 |
commit | 8b8ef8d6331d84638bc253cb7d06faf37e0cc1b3 (patch) | |
tree | 3c817148af388ab73b1a64daf44fd9870b84d330 /xmloff | |
parent | 5085b66ef12298f488c4d7254c31292ef8fa621b (diff) |
Remove the xmloff::token::ResetTokens race condition
...where multiple parallel calls to xmloff::token::ResetTokens or
xmloff::token::GetXMLToken can see dangling pOUString pointers. There is no
point in releasing this (bounded) amount of memory referenced from global
aTokenList, anyway.
There is still a race when parallel calls to xmloff::token::GetXMLToken write to
a pOUString pointer in parallel, but that's more harmless, and maybe calls to
GetXMLToken are synchronized by Solar Mutex? Calls to ResetTokens (e.g., via
URP remote release request -> ~ScXMLExport -> ~SvXMLExport) were definitely
/not/ synchronized via any mutex.
The xmloff::token::Inc/DecRescheduleCount functions are now pointless and have
been removed, too.
Change-Id: I85905d4de1f042ed5c9a37589f942910d8ef80fd
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/core/ProgressBarHelper.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/core/xmlimp.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 32 | ||||
-rw-r--r-- | xmloff/source/transform/TransformerBase.cxx | 2 |
5 files changed, 0 insertions, 42 deletions
diff --git a/xmloff/source/core/ProgressBarHelper.cxx b/xmloff/source/core/ProgressBarHelper.cxx index e20135122175..87b67f73a435 100644 --- a/xmloff/source/core/ProgressBarHelper.cxx +++ b/xmloff/source/core/ProgressBarHelper.cxx @@ -93,12 +93,8 @@ void ProgressBarHelper::SetValue(sal_Int32 nTempValue) double fValue(nValue); double fNewValue ((fValue * nRange) / nReference); - xmloff::token::IncRescheduleCount(); - xStatusIndicator->setValue((sal_Int32)fNewValue); - xmloff::token::DecRescheduleCount(); - // #95181# disabled, because we want to call setValue very often to enable a good reschedule } #ifdef DBG_UTIL diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 1c7643342586..43c3d4dd2576 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -578,8 +578,6 @@ SvXMLExport::~SvXMLExport() delete mpNumExport; } - xmloff::token::ResetTokens(); - if (mxEventListener.is() && mxModel.is()) mxModel->removeEventListener(mxEventListener); diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 757352c75f1c..e733ed760718 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -432,8 +432,6 @@ SvXMLImport::~SvXMLImport() throw () delete mpNumImport; delete mpProgressBarHelper; - xmloff::token::ResetTokens(); - if( mpImpl ) delete mpImpl; diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 92701ba2d3d3..40511048b7a9 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3222,8 +3222,6 @@ namespace xmloff { namespace token { #endif }; - sal_Int32 nRescheduleCount = 0; - // get OUString representation of token const OUString& GetXMLToken( enum XMLTokenEnum eToken ) { @@ -3269,36 +3267,6 @@ namespace xmloff { namespace token { const XMLTokenEntry* pToken = &aTokenList[(sal_uInt16)eToken]; return rString.equalsAsciiL( pToken->pChar, pToken->nLength ); } - - // gives all allocated memory for OUString* back - void ResetTokens() - { - if (nRescheduleCount == 0) - { - for (sal_Int16 i=0, nEnd = sizeof ( aTokenList ) / sizeof ( XMLTokenEntry ); - i < nEnd; - i++) - { - delete aTokenList[i].pOUString; - aTokenList[i].pOUString = NULL; - } - } - } - - void IncRescheduleCount() - { - ++nRescheduleCount; - } - - void DecRescheduleCount() - { - if (nRescheduleCount > 0) - --nRescheduleCount; - else { - OSL_FAIL("RescheduleCount not increased"); - } - } - } } diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx index e93d04adc560..37662a591004 100644 --- a/xmloff/source/transform/TransformerBase.cxx +++ b/xmloff/source/transform/TransformerBase.cxx @@ -201,8 +201,6 @@ XMLTransformerBase::XMLTransformerBase( XMLTransformerActionInit *pInit, XMLTransformerBase::~XMLTransformerBase() throw () { - ResetTokens(); - delete m_pNamespaceMap; delete m_pReplaceNamespaceMap; delete m_pContexts; |