From bb1e28717397505acfad1e21994312273880c4fa Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 4 Aug 2010 17:14:21 +0200 Subject: sw34bf01: #i112783#: unoxml: apply patch by cmc: fix memory leak by removing unnecessary DOM::CDocument::m_aNodeRefList. --- unoxml/source/dom/document.cxx | 38 -------------------------------------- unoxml/source/dom/document.hxx | 4 ---- unoxml/source/dom/node.cxx | 16 ++++------------ 3 files changed, 4 insertions(+), 54 deletions(-) (limited to 'unoxml/source') diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx index 656aa1cbef6c..fcd43832adf0 100644 --- a/unoxml/source/dom/document.cxx +++ b/unoxml/source/dom/document.cxx @@ -53,50 +53,12 @@ namespace DOM { - void CDocument::addnode(xmlNodePtr aNode) - { - if (aNode != (xmlNodePtr)m_aDocPtr) - { - Reference< XNode >* nref = new Reference< XNode >(CNode::get(aNode)); - m_aNodeRefList.push_back(nref); - } - } - CDocument::~CDocument() { - Reference< XNode >* pRef; - nodereflist_t::const_iterator r = m_aNodeRefList.begin(); - while (r!=m_aNodeRefList.end()) - { - pRef = *r; - delete pRef; - r++; - } - - // get rid of leftover instances, if anybody still holds a - // reference to one of these, it will be invalid! - /* - CNode* aNode = 0; - nodelist_t::const_iterator i = m_aNodeList.begin(); - while (i!=m_aNodeList.end()) - { - aNode = CNode::get(*i, sal_False); - if (aNode != 0) - { - // CNode::remove(*i); - // delete will remove - delete aNode; - } - i++; - } - */ - xmlFreeDoc(m_aDocPtr); - } CDocument::CDocument(xmlDocPtr aDocPtr): - m_aNodeRefList(), m_aDocPtr(aDocPtr), m_streamListeners() { diff --git a/unoxml/source/dom/document.hxx b/unoxml/source/dom/document.hxx index b653619031a1..9a54b1512b16 100644 --- a/unoxml/source/dom/document.hxx +++ b/unoxml/source/dom/document.hxx @@ -76,8 +76,6 @@ namespace DOM typedef set< Reference< XStreamListener > > listenerlist_t; private: - nodereflist_t m_aNodeRefList; - xmlDocPtr m_aDocPtr; // datacontrol/source state @@ -87,8 +85,6 @@ namespace DOM protected: CDocument(xmlDocPtr aDocPtr); - void addnode(xmlNodePtr aNode); - public: virtual ~CDocument(); diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx index 2a03896502a9..412f9982fdc7 100644 --- a/unoxml/source/dom/node.cxx +++ b/unoxml/source/dom/node.cxx @@ -209,7 +209,7 @@ namespace DOM // m_aNodeType = NodeType::NOTATION_NODE; pNode = static_cast< CNode* >(new CAttr((xmlAttrPtr)aNode)); break; - // unsopported node types + // unsupported node types case XML_HTML_DOCUMENT_NODE: case XML_ELEMENT_DECL: case XML_ATTRIBUTE_DECL: @@ -219,18 +219,10 @@ namespace DOM pNode = 0; break; } - } - if ( pNode != 0 ) - { - if(CNode::theNodeMap.insert(nodemap_t::value_type(aNode, pNode)).second) + + if ( pNode != 0 ) { - // insertion done, register node with document - xmlDocPtr doc = aNode->doc; - if( doc != NULL) - { - CDocument* pDoc = static_cast< CDocument* >(CNode::get((xmlNodePtr)doc)); - pDoc->addnode(aNode); - } else + if(!CNode::theNodeMap.insert(nodemap_t::value_type(aNode, pNode)).second) { // if insertion failed, delete the new instance and return null delete pNode; -- cgit From f6af5e431cd8b4e96f98ce8af013f54a3d6f903d Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 4 Aug 2010 17:18:20 +0200 Subject: sw34bf01: #i112783#: unoxml: remove DOM::CDocument::nodereflist_t --- unoxml/source/dom/document.hxx | 1 - 1 file changed, 1 deletion(-) (limited to 'unoxml/source') diff --git a/unoxml/source/dom/document.hxx b/unoxml/source/dom/document.hxx index 9a54b1512b16..3fe593ff2b24 100644 --- a/unoxml/source/dom/document.hxx +++ b/unoxml/source/dom/document.hxx @@ -72,7 +72,6 @@ namespace DOM XActiveDataControl, XActiveDataSource, XSAXSerializable, XFastSAXSerializable> { friend class CNode; - typedef std::list< Reference< XNode >* > nodereflist_t; typedef set< Reference< XStreamListener > > listenerlist_t; private: -- cgit From 7788dc10a3b53efa890635b3779f103879e9e55a Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 10 Sep 2010 13:10:07 +0200 Subject: sb129: #i113189# change UNO components to use passive registration --- unoxml/source/rdf/librdf_services.cxx | 7 ------ unoxml/source/rdf/makefile.mk | 8 +++++++ unoxml/source/rdf/unordf.component | 43 ++++++++++++++++++++++++++++++++++ unoxml/source/service/makefile.mk | 8 +++++++ unoxml/source/service/services.cxx | 38 ------------------------------ unoxml/source/service/unoxml.component | 43 ++++++++++++++++++++++++++++++++++ 6 files changed, 102 insertions(+), 45 deletions(-) create mode 100644 unoxml/source/rdf/unordf.component create mode 100644 unoxml/source/service/unoxml.component (limited to 'unoxml/source') diff --git a/unoxml/source/rdf/librdf_services.cxx b/unoxml/source/rdf/librdf_services.cxx index 03949934560d..08e776d214fe 100644 --- a/unoxml/source/rdf/librdf_services.cxx +++ b/unoxml/source/rdf/librdf_services.cxx @@ -72,12 +72,5 @@ extern "C" void * SAL_CALL component_getFactory( implName, serviceManager, registryKey, entries); } -extern "C" sal_Bool SAL_CALL component_writeInfo( - void * serviceManager, void * registryKey) -{ - return ::cppu::component_writeInfoHelper(serviceManager, registryKey, - entries); -} - } // extern "C" diff --git a/unoxml/source/rdf/makefile.mk b/unoxml/source/rdf/makefile.mk index 3f6d7f445297..1dbcffb8b6ac 100644 --- a/unoxml/source/rdf/makefile.mk +++ b/unoxml/source/rdf/makefile.mk @@ -82,3 +82,11 @@ SHL1STDLIBS= \ .INCLUDE : target.mk + +ALLTAR : $(MISC)/unordf.component + +$(MISC)/unordf.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + unordf.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt unordf.component diff --git a/unoxml/source/rdf/unordf.component b/unoxml/source/rdf/unordf.component new file mode 100644 index 000000000000..a828e7b05d47 --- /dev/null +++ b/unoxml/source/rdf/unordf.component @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + diff --git a/unoxml/source/service/makefile.mk b/unoxml/source/service/makefile.mk index 93aec0746323..5fbe62f67ec4 100644 --- a/unoxml/source/service/makefile.mk +++ b/unoxml/source/service/makefile.mk @@ -76,3 +76,11 @@ SHL1STDLIBS= \ .INCLUDE : target.mk + +ALLTAR : $(MISC)/unoxml.component + +$(MISC)/unoxml.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + unoxml.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt unoxml.component diff --git a/unoxml/source/service/services.cxx b/unoxml/source/service/services.cxx index 218015852c83..6b1a2f6f0979 100644 --- a/unoxml/source/service/services.cxx +++ b/unoxml/source/service/services.cxx @@ -60,44 +60,6 @@ component_getImplementationEnvironment(const sal_Char **ppEnvironmentTypeName, u *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; } -sal_Bool SAL_CALL -component_writeInfo(void * /*pServiceManager*/, void* pRegistryKey ) -{ - Reference< XRegistryKey > xKey(reinterpret_cast< XRegistryKey* >(pRegistryKey)); - Reference< XRegistryKey > xNewKey; - OUString aImpl; - - // register DOM service - aImpl = OUString(RTL_CONSTASCII_USTRINGPARAM("/")); - aImpl += CDocumentBuilder::_getImplementationName(); - aImpl += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); - xNewKey = xKey->createKey(aImpl); - xNewKey->createKey(CDocumentBuilder::_getSupportedServiceNames()[0]); - - // register DOM service - aImpl = OUString(RTL_CONSTASCII_USTRINGPARAM("/")); - aImpl += CSAXDocumentBuilder::_getImplementationName(); - aImpl += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); - xNewKey = xKey->createKey(aImpl); - xNewKey->createKey(CSAXDocumentBuilder::_getSupportedServiceNames()[0]); - - // register XPath service - aImpl = OUString(RTL_CONSTASCII_USTRINGPARAM("/")); - aImpl += CXPathAPI::_getImplementationName(); - aImpl += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); - xNewKey = xKey->createKey(aImpl); - xNewKey->createKey(CXPathAPI::_getSupportedServiceNames()[0]); - - // register EventTest service - aImpl = OUString(RTL_CONSTASCII_USTRINGPARAM("/")); - aImpl += CTestListener::_getImplementationName(); - aImpl += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); - xNewKey = xKey->createKey(aImpl); - xNewKey->createKey(CTestListener::_getSupportedServiceNames()[0]); - - return sal_True; -} - void* SAL_CALL component_getFactory(const sal_Char *pImplementationName, void *pServiceManager, void * /*pRegistryKey*/) { diff --git a/unoxml/source/service/unoxml.component b/unoxml/source/service/unoxml.component new file mode 100644 index 000000000000..d8c907e6475b --- /dev/null +++ b/unoxml/source/service/unoxml.component @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + -- cgit From fe3404b618a42d0d2800e3073ce31c377aa162bb Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 14 Oct 2010 18:10:36 +0200 Subject: sw34bf01: #i112783#: patch by cmc: fix crash in xpathobject.cxx --- unoxml/source/xpath/xpathapi.cxx | 2 +- unoxml/source/xpath/xpathobject.cxx | 4 ++-- unoxml/source/xpath/xpathobject.hxx | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'unoxml/source') diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx index 80666d9e2031..f40082e25e9b 100644 --- a/unoxml/source/xpath/xpathapi.cxx +++ b/unoxml/source/xpath/xpathapi.cxx @@ -352,7 +352,7 @@ namespace XPath throw XPathException(); } xmlXPathFreeContext(xpathCtx); - Reference< XXPathObject > aObj(new CXPathObject(xpathObj)); + Reference< XXPathObject > aObj(new CXPathObject(xpathObj, contextNode)); return aObj; } diff --git a/unoxml/source/xpath/xpathobject.cxx b/unoxml/source/xpath/xpathobject.cxx index 083d19080c4b..757de0c5aac4 100644 --- a/unoxml/source/xpath/xpathobject.cxx +++ b/unoxml/source/xpath/xpathobject.cxx @@ -31,8 +31,8 @@ namespace XPath { - CXPathObject::CXPathObject(xmlXPathObjectPtr xpathObj) - : m_pXPathObj(xpathObj, xmlXPathFreeObject) + CXPathObject::CXPathObject(xmlXPathObjectPtr xpathObj, const Reference< XNode >& contextNode) + : m_pXPathObj(xpathObj, xmlXPathFreeObject), m_xContextNode(contextNode) { switch (m_pXPathObj->type) { diff --git a/unoxml/source/xpath/xpathobject.hxx b/unoxml/source/xpath/xpathobject.hxx index 8e256bc8a994..348fae8e21e6 100644 --- a/unoxml/source/xpath/xpathobject.hxx +++ b/unoxml/source/xpath/xpathobject.hxx @@ -52,10 +52,11 @@ namespace XPath { private: boost::shared_ptr m_pXPathObj; + const Reference< XNode > m_xContextNode; XPathObjectType m_xPathObjectType; public: - CXPathObject(xmlXPathObjectPtr xpathObj); + CXPathObject(xmlXPathObjectPtr xpathObj, const Reference< XNode >& contextNode); /** get object type -- cgit From 66183dd2d83741963a9b9f69965731e279a4d776 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 14 Oct 2010 18:13:35 +0200 Subject: sw34bf01: #i112783#: fix Reference& member --- unoxml/source/xpath/xpathapi.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'unoxml/source') diff --git a/unoxml/source/xpath/xpathapi.hxx b/unoxml/source/xpath/xpathapi.hxx index fdfff24353cc..048fafaae8e9 100644 --- a/unoxml/source/xpath/xpathapi.hxx +++ b/unoxml/source/xpath/xpathapi.hxx @@ -69,7 +69,7 @@ namespace XPath private: nsmap_t m_nsmap; - const Reference < XMultiServiceFactory >& m_aFactory; + const Reference< XMultiServiceFactory > m_aFactory; extensions_t m_extensions; public: -- cgit From a7e4b74c1cb2d22b3c31bea8cf20f56bff5a7426 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 18 Oct 2010 12:52:07 +0200 Subject: #i114999#: include redland.h instead of librdf.h --- unoxml/source/rdf/librdf_repository.cxx | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'unoxml/source') diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx index a7e50e7e232d..83de4df8050f 100644 --- a/unoxml/source/rdf/librdf_repository.cxx +++ b/unoxml/source/rdf/librdf_repository.cxx @@ -39,7 +39,10 @@ #include #include -#include +#include + +// #i114999# do not include librdf.h, it is broken in redland 1.0.11 +#include #include #include @@ -64,19 +67,6 @@ #include #include #include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include /** -- cgit