From af50794fa05552cfc1112b250c32f5e6aaa1f8a4 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(-) diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx index c7772ae72..80258cd1d 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 2315e57c6..c2a0ef1ee 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 f44e56d62..736b9916d 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 v1.2.3 From 72f3e87e917abb185d285141f8430c39d1eab311 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(-) diff --git a/unoxml/source/dom/document.hxx b/unoxml/source/dom/document.hxx index c2a0ef1ee..687381b3c 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 v1.2.3 From 4120894e2a250e66ebd5ee2d4a0de140e51750b5 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 27 Sep 2010 15:09:27 +0200 Subject: sw34bf01: #i114284#: patch by dtardon: fix build with -DDEBUG_DOMAINMAPPER --- writerfilter/source/dmapper/DomainMapper_Impl.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 50d663788..173e7b29e 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -889,7 +889,7 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap ) #ifdef DEBUG_DOMAINMAPPER dmapper_logger->attribute("isTextAppend", xTextAppend.is()); - dmapper_logger->attribute("isIgnor", m_TableManager.isIgnore()); + dmapper_logger->attribute("isIgnor", getTableManager().isIgnore()); #endif if(xTextAppend.is() && ! getTableManager( ).isIgnore()) -- cgit v1.2.3 From b26836d5fbc3b7de44acb92e9f097679b0d5d149 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 27 Sep 2010 15:11:48 +0200 Subject: sw34bf01: #i114285#: patch by dtardon: fix build with -DEBUG_CONTEXT_STACK --- writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx index 0cf7373f0..9bbee0e40 100644 --- a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx @@ -200,9 +200,6 @@ void SAL_CALL OOXMLFastDocumentHandler::startDocument() void SAL_CALL OOXMLFastDocumentHandler::endDocument() throw (uno::RuntimeException, xml::sax::SAXException) { -#ifdef DEBUG_CONTEXT_STACK - OOXMLFastContextHandler::dumpOpenContexts(); -#endif } void SAL_CALL OOXMLFastDocumentHandler::setDocumentLocator -- cgit v1.2.3 From 822537cb0ad1c517bb3d5850ac8901c3b4d06202 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 27 Sep 2010 15:24:47 +0200 Subject: sw34bf01: #i114542#: patch by dtardon: initialize member arrays of BorderHandler --- writerfilter/source/dmapper/BorderHandler.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/writerfilter/source/dmapper/BorderHandler.cxx b/writerfilter/source/dmapper/BorderHandler.cxx index 9e034fe80..f7483ef1b 100644 --- a/writerfilter/source/dmapper/BorderHandler.cxx +++ b/writerfilter/source/dmapper/BorderHandler.cxx @@ -51,6 +51,9 @@ BorderHandler::BorderHandler( bool bOOXML ) : m_nLineDistance(0), m_bOOXML( bOOXML ) { + const int nBorderCount(BORDER_COUNT); + std::fill_n(m_aFilledLines, nBorderCount, false); + std::fill_n(m_aBorderLines, nBorderCount, table::BorderLine()); } /*-- 24.04.2007 09:06:35--------------------------------------------------- -- cgit v1.2.3 From 76c83d3d074ca6681989d55efaf89eedabc824cf Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 27 Sep 2010 15:30:43 +0200 Subject: sw34bf01: #i114549#: patch by dtardon: fix array limit --- writerfilter/source/dmapper/StyleSheetTable.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 549dd156c..ef1ec1f7f 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -235,7 +235,7 @@ void lcl_mergeProps( PropertyMapPtr pToFill, PropertyMapPtr pToAdd, TblStyleTyp ( nStyleId == TBL_STYLE_FIRSTCOL ) }; - for ( int i = 0 ; i < 7; i++ ) + for ( unsigned i = 0 ; i != sizeof(pPropsToCheck) / sizeof(PropertyIds); i++ ) { PropertyIds nId = pPropsToCheck[i]; PropertyDefinition aProp( nId, false ); -- cgit v1.2.3 From a45c5fcd9b37dc1a47eabe8818f716d3c0ec1252 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 27 Sep 2010 15:35:46 +0200 Subject: sw34bf01: #i144667#: patch by dtardon: add missing include for build with -DDEBUG_ATTRIBUTES --- writerfilter/source/ooxml/OOXMLFactory.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/writerfilter/source/ooxml/OOXMLFactory.cxx b/writerfilter/source/ooxml/OOXMLFactory.cxx index 80f0ebfb2..3923a4250 100755 --- a/writerfilter/source/ooxml/OOXMLFactory.cxx +++ b/writerfilter/source/ooxml/OOXMLFactory.cxx @@ -25,6 +25,8 @@ * ************************************************************************/ +#include + #include #include #include "OOXMLFactory.hxx" -- cgit v1.2.3 From 52a450f1f35d62db8c2e338784e170a7923a63c2 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 4 Oct 2010 16:57:15 +0200 Subject: sw34bf01: FontTable::getFontEntry(): put shared_ptr into vector --- writerfilter/source/dmapper/FontTable.cxx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/writerfilter/source/dmapper/FontTable.cxx b/writerfilter/source/dmapper/FontTable.cxx index 191bc50a9..a5338dc80 100644 --- a/writerfilter/source/dmapper/FontTable.cxx +++ b/writerfilter/source/dmapper/FontTable.cxx @@ -39,7 +39,7 @@ namespace dmapper struct FontTable_Impl { - std::vector< FontEntry > aFontEntries; + std::vector< FontEntry::Pointer_t > aFontEntries; FontEntry::Pointer_t pCurrentEntry; FontTable_Impl() {} }; @@ -568,7 +568,7 @@ void FontTable::entry(int /*pos*/, writerfilter::Reference::Pointer_ m_pImpl->pCurrentEntry.reset(new FontEntry); ref->resolve(*this); //append it to the table - m_pImpl->aFontEntries.push_back( *m_pImpl->pCurrentEntry ); + m_pImpl->aFontEntries.push_back( m_pImpl->pCurrentEntry ); m_pImpl->pCurrentEntry.reset(); } /*-- 19.06.2006 12:04:34--------------------------------------------------- @@ -657,12 +657,9 @@ void FontTable::endShape( ) -----------------------------------------------------------------------*/ const FontEntry::Pointer_t FontTable::getFontEntry(sal_uInt32 nIndex) { - FontEntry::Pointer_t pRet; - if(m_pImpl->aFontEntries.size() > nIndex) - { - pRet.reset(&m_pImpl->aFontEntries[nIndex]); - } - return pRet; + return (m_pImpl->aFontEntries.size() > nIndex) + ? m_pImpl->aFontEntries[nIndex] + : FontEntry::Pointer_t(); } /*-- 21.06.2006 11:21:38--------------------------------------------------- -- cgit v1.2.3 From cffa064c24e16af6fda4f50f56924a149e9aba3e 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(-) diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx index 7fc17f0fb..426aead47 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 b1fea8974..815d17abf 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 a726defbd..95c2e785e 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 v1.2.3 From 3c4fdb9c53def5b762ae3190c5888b4d44d2ebb4 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(-) diff --git a/unoxml/source/xpath/xpathapi.hxx b/unoxml/source/xpath/xpathapi.hxx index 538b97e7e..fd4fe1df4 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 v1.2.3 From c2ce890fc52032bebb2df9a259d5f339d21f7d3d 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(-) diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx index 3d2acf0c2..13dd5b0bb 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 v1.2.3