summaryrefslogtreecommitdiff
path: root/unoxml
diff options
context:
space:
mode:
authorJoachim Lingner <jl@openoffice.org>2010-08-05 12:22:22 +0200
committerJoachim Lingner <jl@openoffice.org>2010-08-05 12:22:22 +0200
commit1c5011a89faf5cc8990e6e7b0cff3922a7fd9888 (patch)
treeb7bd3ad005596ae6451461faa622a0108b2365f4 /unoxml
parented873a73fde10c2a9511388024bef97522517cf4 (diff)
jl157 #161910# make access to static map in unoxml threadsafe
Diffstat (limited to 'unoxml')
-rw-r--r--unoxml/source/dom/node.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx
index 2a03896502a9..41d7c253d534 100644
--- a/unoxml/source/dom/node.cxx
+++ b/unoxml/source/dom/node.cxx
@@ -43,13 +43,18 @@
#include "attr.hxx"
#include <com/sun/star/xml/sax/FastToken.hpp>
-
+#include "rtl/instance.hxx"
+#include "osl/mutex.hxx"
#include "../events/eventdispatcher.hxx"
#include "../events/mutationevent.hxx"
#include <boost/bind.hpp>
#include <algorithm>
+namespace {
+ struct NodeMutex: public ::rtl::Static<osl::Mutex, NodeMutex> {};
+}
+
namespace DOM
{
void pushContext(Context& io_rContext)
@@ -131,6 +136,7 @@ namespace DOM
void CNode::remove(const xmlNodePtr aNode)
{
+ ::osl::MutexGuard guard(NodeMutex::get());
nodemap_t::iterator i = CNode::theNodeMap.find(aNode);
if (i != CNode::theNodeMap.end())
{
@@ -145,7 +151,7 @@ namespace DOM
CNode* pNode = 0;
if (aNode == NULL)
return 0;
-
+ ::osl::MutexGuard guard(NodeMutex::get());
//check whether there is already an instance for this node
nodemap_t::const_iterator i = CNode::theNodeMap.find(aNode);
if (i != CNode::theNodeMap.end())