From 1c5011a89faf5cc8990e6e7b0cff3922a7fd9888 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Thu, 5 Aug 2010 12:22:22 +0200 Subject: [PATCH] jl157 #161910# make access to static map in unoxml threadsafe --- unoxml/source/dom/node.cxx | 10 ++++++++-- 1 file 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 - +#include "rtl/instance.hxx" +#include "osl/mutex.hxx" #include "../events/eventdispatcher.hxx" #include "../events/mutationevent.hxx" #include #include +namespace { + struct NodeMutex: public ::rtl::Static {}; +} + 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())