summaryrefslogtreecommitdiff
path: root/unoxml
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2011-01-19 20:27:26 +0100
committerMichael Stahl <mst@openoffice.org>2011-01-19 20:27:26 +0100
commitdd995cea7b9a262d51b94d536817e5aa2950f1cb (patch)
tree2e073aa8b06139cc3522d9c4cab58338793d7ff2 /unoxml
parent12de6d548b19e4d016e7a7be0980c2d78fe20d17 (diff)
xmlfix3: #i113682#: unoxml: use CDocument mutex in misc classes
Diffstat (limited to 'unoxml')
-rw-r--r--unoxml/source/dom/attributesmap.cxx16
-rw-r--r--unoxml/source/dom/attributesmap.hxx4
-rw-r--r--unoxml/source/dom/childlist.cxx8
-rw-r--r--unoxml/source/dom/childlist.hxx4
-rw-r--r--unoxml/source/dom/document.cxx6
-rw-r--r--unoxml/source/dom/documenttype.cxx4
-rw-r--r--unoxml/source/dom/element.cxx8
-rw-r--r--unoxml/source/dom/elementlist.cxx9
-rw-r--r--unoxml/source/dom/elementlist.hxx2
-rw-r--r--unoxml/source/dom/entitiesmap.cxx4
-rw-r--r--unoxml/source/dom/entitiesmap.hxx4
-rw-r--r--unoxml/source/dom/node.cxx2
-rw-r--r--unoxml/source/dom/notationsmap.cxx4
-rw-r--r--unoxml/source/dom/notationsmap.hxx4
14 files changed, 62 insertions, 17 deletions
diff --git a/unoxml/source/dom/attributesmap.cxx b/unoxml/source/dom/attributesmap.cxx
index cad05123bf96..fbd613fcc2fb 100644
--- a/unoxml/source/dom/attributesmap.cxx
+++ b/unoxml/source/dom/attributesmap.cxx
@@ -35,8 +35,10 @@
namespace DOM
{
- CAttributesMap::CAttributesMap(::rtl::Reference<CElement> const& pElement)
+ CAttributesMap::CAttributesMap(::rtl::Reference<CElement> const& pElement,
+ ::osl::Mutex & rMutex)
: m_pElement(pElement)
+ , m_rMutex(rMutex)
{
}
@@ -45,6 +47,8 @@ namespace DOM
*/
sal_Int32 SAL_CALL CAttributesMap::getLength() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_rMutex);
+
sal_Int32 count = 0;
xmlNodePtr pNode = m_pElement->m_aNodePtr;
if (pNode != NULL)
@@ -65,6 +69,8 @@ namespace DOM
Reference< XNode > SAL_CALL
CAttributesMap::getNamedItem(OUString const& name) throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_rMutex);
+
Reference< XNode > aNode;
xmlNodePtr pNode = m_pElement->m_aNodePtr;
if (pNode != NULL)
@@ -95,6 +101,8 @@ namespace DOM
OUString const& namespaceURI, OUString const& localName)
throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_rMutex);
+
Reference< XNode > aNode;
xmlNodePtr pNode = m_pElement->m_aNodePtr;
if (pNode != NULL)
@@ -127,6 +135,8 @@ namespace DOM
Reference< XNode > SAL_CALL
CAttributesMap::item(sal_Int32 index) throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_rMutex);
+
Reference< XNode > aNode;
xmlNodePtr pNode = m_pElement->m_aNodePtr;
if (pNode != NULL)
@@ -156,6 +166,8 @@ namespace DOM
CAttributesMap::removeNamedItem(OUString const& name)
throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_rMutex);
+
xmlNodePtr const pNode = m_pElement->m_aNodePtr;
if (pNode != NULL)
{
@@ -187,6 +199,8 @@ namespace DOM
OUString const& namespaceURI, OUString const& localName)
throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_rMutex);
+
xmlNodePtr const pNode = m_pElement->m_aNodePtr;
if (pNode != NULL)
{
diff --git a/unoxml/source/dom/attributesmap.hxx b/unoxml/source/dom/attributesmap.hxx
index d61b96213785..b987349c9194 100644
--- a/unoxml/source/dom/attributesmap.hxx
+++ b/unoxml/source/dom/attributesmap.hxx
@@ -51,9 +51,11 @@ namespace DOM
{
private:
::rtl::Reference<CElement> const m_pElement;
+ ::osl::Mutex & m_rMutex;
public:
- CAttributesMap(::rtl::Reference<CElement> const& pElement);
+ CAttributesMap(::rtl::Reference<CElement> const& pElement,
+ ::osl::Mutex & rMutex);
/**
The number of nodes in this map.
diff --git a/unoxml/source/dom/childlist.cxx b/unoxml/source/dom/childlist.cxx
index f50c7b4892f7..bb1f4962aff1 100644
--- a/unoxml/source/dom/childlist.cxx
+++ b/unoxml/source/dom/childlist.cxx
@@ -35,8 +35,10 @@
namespace DOM
{
- CChildList::CChildList(::rtl::Reference<CNode> const& pBase)
+ CChildList::CChildList(::rtl::Reference<CNode> const& pBase,
+ ::osl::Mutex & rMutex)
: m_pNode(pBase)
+ , m_rMutex(rMutex)
{
}
@@ -45,6 +47,8 @@ namespace DOM
*/
sal_Int32 SAL_CALL CChildList::getLength() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_rMutex);
+
sal_Int32 length = 0;
if (m_pNode != NULL)
{
@@ -67,6 +71,8 @@ namespace DOM
Reference< XNode > SAL_CALL CChildList::item(sal_Int32 index)
throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_rMutex);
+
if (m_pNode != NULL)
{
xmlNodePtr cur = m_pNode->m_aNodePtr;
diff --git a/unoxml/source/dom/childlist.hxx b/unoxml/source/dom/childlist.hxx
index 9d3dec0a147a..f23617e49806 100644
--- a/unoxml/source/dom/childlist.hxx
+++ b/unoxml/source/dom/childlist.hxx
@@ -51,9 +51,11 @@ namespace DOM
{
private:
::rtl::Reference<CNode> const m_pNode;
+ ::osl::Mutex & m_rMutex;
public:
- CChildList(::rtl::Reference<CNode> const& pBase);
+ CChildList(::rtl::Reference<CNode> const& pBase,
+ ::osl::Mutex & rMutex);
/**
The number of nodes in the list.
diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx
index b37a3b98aab9..bac3bc8f9249 100644
--- a/unoxml/source/dom/document.cxx
+++ b/unoxml/source/dom/document.cxx
@@ -686,7 +686,7 @@ namespace DOM
::osl::MutexGuard const g(m_Mutex);
Reference< XNodeList > const xRet(
- new CElementList(this->GetDocumentElement(), rTagname));
+ new CElementList(this->GetDocumentElement(), m_Mutex, rTagname));
return xRet;
}
@@ -697,8 +697,8 @@ namespace DOM
::osl::MutexGuard const g(m_Mutex);
Reference< XNodeList > const xRet(
- new CElementList(
- this->GetDocumentElement(), rLocalName, &rNamespaceURI));
+ new CElementList(this->GetDocumentElement(), m_Mutex,
+ rLocalName, &rNamespaceURI));
return xRet;
}
diff --git a/unoxml/source/dom/documenttype.cxx b/unoxml/source/dom/documenttype.cxx
index 1b0893912443..5042dbaaea61 100644
--- a/unoxml/source/dom/documenttype.cxx
+++ b/unoxml/source/dom/documenttype.cxx
@@ -56,7 +56,7 @@ namespace DOM
Reference< XNamedNodeMap > aMap;
if (m_aDtdPtr != NULL)
{
- aMap = Reference< XNamedNodeMap >(new CEntitiesMap(this));
+ aMap.set(new CEntitiesMap(this, m_rMutex));
}
return aMap;
}
@@ -96,7 +96,7 @@ namespace DOM
Reference< XNamedNodeMap > aMap;
if (m_aDtdPtr != NULL)
{
- aMap.set(new CNotationsMap(this));
+ aMap.set(new CNotationsMap(this, m_rMutex));
}
return aMap;
}
diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx
index 83f61086bb0b..eb1d27010c26 100644
--- a/unoxml/source/dom/element.cxx
+++ b/unoxml/source/dom/element.cxx
@@ -323,7 +323,8 @@ namespace DOM
{
::osl::MutexGuard const g(m_rMutex);
- Reference< XNodeList > const xList(new CElementList(this, rLocalName));
+ Reference< XNodeList > const xList(
+ new CElementList(this, m_rMutex, rLocalName));
return xList;
}
@@ -340,7 +341,7 @@ namespace DOM
::osl::MutexGuard const g(m_rMutex);
Reference< XNodeList > const xList(
- new CElementList(this, rLocalName, &rNamespaceURI));
+ new CElementList(this, m_rMutex, rLocalName, &rNamespaceURI));
return xList;
}
@@ -693,7 +694,8 @@ namespace DOM
::osl::MutexGuard const g(m_rMutex);
if (!hasAttributes()) { return 0; }
- Reference< XNamedNodeMap > const xMap(new CAttributesMap(this));
+ Reference< XNamedNodeMap > const xMap(
+ new CAttributesMap(this, m_rMutex));
return xMap;
}
diff --git a/unoxml/source/dom/elementlist.cxx b/unoxml/source/dom/elementlist.cxx
index 1112c16ce231..6ee0e3fce3ab 100644
--- a/unoxml/source/dom/elementlist.cxx
+++ b/unoxml/source/dom/elementlist.cxx
@@ -46,8 +46,10 @@ namespace DOM
}
CElementList::CElementList(::rtl::Reference<CElement> const& pElement,
+ ::osl::Mutex & rMutex,
OUString const& rName, OUString const*const pURI)
: m_pElement(pElement)
+ , m_rMutex(rMutex)
, m_pName(lcl_initXmlString(rName))
, m_pURI((pURI) ? lcl_initXmlString(*pURI) : 0)
, m_bRebuild(true)
@@ -111,6 +113,8 @@ namespace DOM
*/
sal_Int32 SAL_CALL CElementList::getLength() throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_rMutex);
+
// this has to be 'live'
buildlist(static_cast<const CNode*>(m_pElement.get())->m_aNodePtr);
return m_nodevector.size();
@@ -122,6 +126,9 @@ namespace DOM
throw (RuntimeException)
{
if (index < 0) throw RuntimeException();
+
+ ::osl::MutexGuard const g(m_rMutex);
+
buildlist(static_cast<const CNode*>(m_pElement.get())->m_aNodePtr);
if (m_nodevector.size() <= static_cast<size_t>(index)) {
throw RuntimeException();
@@ -135,6 +142,8 @@ namespace DOM
void SAL_CALL CElementList::handleEvent(Reference< XEvent > const&)
throw (RuntimeException)
{
+ ::osl::MutexGuard const g(m_rMutex);
+
m_bRebuild = true;
}
}
diff --git a/unoxml/source/dom/elementlist.hxx b/unoxml/source/dom/elementlist.hxx
index d2a317a2f5f1..95b9960e700f 100644
--- a/unoxml/source/dom/elementlist.hxx
+++ b/unoxml/source/dom/elementlist.hxx
@@ -64,6 +64,7 @@ namespace DOM
{
private:
::rtl::Reference<CElement> const m_pElement;
+ ::osl::Mutex & m_rMutex;
::boost::scoped_array<xmlChar> const m_pName;
::boost::scoped_array<xmlChar> const m_pURI;
bool m_bRebuild;
@@ -74,6 +75,7 @@ namespace DOM
public:
CElementList(::rtl::Reference<CElement> const& pElement,
+ ::osl::Mutex & rMutex,
OUString const& rName, OUString const*const pURI = 0);
/**
diff --git a/unoxml/source/dom/entitiesmap.cxx b/unoxml/source/dom/entitiesmap.cxx
index a88b40b590c5..960936ce0aa9 100644
--- a/unoxml/source/dom/entitiesmap.cxx
+++ b/unoxml/source/dom/entitiesmap.cxx
@@ -32,8 +32,10 @@
namespace DOM
{
- CEntitiesMap::CEntitiesMap(::rtl::Reference<CDocumentType> const& pDocType)
+ CEntitiesMap::CEntitiesMap(::rtl::Reference<CDocumentType> const& pDocType,
+ ::osl::Mutex & rMutex)
: m_pDocType(pDocType)
+ , m_rMutex(rMutex)
{
}
diff --git a/unoxml/source/dom/entitiesmap.hxx b/unoxml/source/dom/entitiesmap.hxx
index 754725a94b4a..468e897639db 100644
--- a/unoxml/source/dom/entitiesmap.hxx
+++ b/unoxml/source/dom/entitiesmap.hxx
@@ -51,9 +51,11 @@ namespace DOM
{
private:
::rtl::Reference<CDocumentType> const m_pDocType;
+ ::osl::Mutex & m_rMutex;
public:
- CEntitiesMap(::rtl::Reference<CDocumentType> const& pDocType);
+ CEntitiesMap(::rtl::Reference<CDocumentType> const& pDocType,
+ ::osl::Mutex & rMutex);
/**
The number of nodes in this map.
diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx
index 501fd134c793..55978a507a67 100644
--- a/unoxml/source/dom/node.cxx
+++ b/unoxml/source/dom/node.cxx
@@ -452,7 +452,7 @@ namespace DOM
if (0 == m_aNodePtr) {
return 0;
}
- Reference< XNodeList > const xNodeList(new CChildList(this));
+ Reference< XNodeList > const xNodeList(new CChildList(this, m_rMutex));
return xNodeList;
}
diff --git a/unoxml/source/dom/notationsmap.cxx b/unoxml/source/dom/notationsmap.cxx
index d985c48eaf74..adda914ee166 100644
--- a/unoxml/source/dom/notationsmap.cxx
+++ b/unoxml/source/dom/notationsmap.cxx
@@ -33,8 +33,10 @@
namespace DOM
{
CNotationsMap::CNotationsMap(
- ::rtl::Reference<CDocumentType> const& pDocType)
+ ::rtl::Reference<CDocumentType> const& pDocType,
+ ::osl::Mutex & rMutex)
: m_pDocType(pDocType)
+ , m_rMutex(rMutex)
{
}
diff --git a/unoxml/source/dom/notationsmap.hxx b/unoxml/source/dom/notationsmap.hxx
index cb1a29185544..42648311374b 100644
--- a/unoxml/source/dom/notationsmap.hxx
+++ b/unoxml/source/dom/notationsmap.hxx
@@ -51,9 +51,11 @@ namespace DOM
{
private:
::rtl::Reference<CDocumentType> const m_pDocType;
+ ::osl::Mutex & m_rMutex;
public:
- CNotationsMap(::rtl::Reference<CDocumentType> const& pDocType);
+ CNotationsMap(::rtl::Reference<CDocumentType> const& pDocType,
+ ::osl::Mutex & rMutex);
/**
The number of nodes in this map.