jl157 #161910# make access to static map in unoxml threadsafe

This commit is contained in:
Joachim Lingner 2010-08-05 12:22:22 +02:00
parent ed873a73fd
commit 1c5011a89f

View file

@ -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())