[Libreoffice-commits] core.git: include/xmloff xmloff/source
Stephan Bergmann
sbergman at redhat.com
Thu Oct 31 12:51:37 CET 2013
include/xmloff/xmltoken.hxx | 9 -------
xmloff/source/core/ProgressBarHelper.cxx | 4 ---
xmloff/source/core/xmlexp.cxx | 2 -
xmloff/source/core/xmlimp.cxx | 2 -
xmloff/source/core/xmltoken.cxx | 32 ----------------------------
xmloff/source/transform/TransformerBase.cxx | 2 -
6 files changed, 51 deletions(-)
New commits:
commit 8b8ef8d6331d84638bc253cb7d06faf37e0cc1b3
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Oct 31 12:45:04 2013 +0100
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
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 265a2e5..360a01b 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3227,15 +3227,6 @@ namespace xmloff { namespace token {
XMLOFF_DLLPUBLIC sal_Bool IsXMLToken(
const OUString& rString,
enum XMLTokenEnum eToken );
-
- // gives all allocated memory for OUString* back
- XMLOFF_DLLPUBLIC void ResetTokens();
-
- XMLOFF_DLLPUBLIC void IncRescheduleCount();
-
- XMLOFF_DLLPUBLIC void DecRescheduleCount();
-
-
} }
#endif
diff --git a/xmloff/source/core/ProgressBarHelper.cxx b/xmloff/source/core/ProgressBarHelper.cxx
index e201351..87b67f7 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 1c76433..43c3d4d 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 757352c..e733ed7 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 92701ba..4051104 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 e93d04a..37662a5 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;
More information about the Libreoffice-commits
mailing list