From 084de9dda40095937dfb990fc39edea31626dba3 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Thu, 8 Sep 2016 15:40:23 +0200 Subject: [PATCH] remove manual memory management Change-Id: Ic715adae42ff34be892d19802629aa50077dc120 --- include/xmloff/txtstyli.hxx | 3 +-- xmloff/source/text/txtstyli.cxx | 18 ++++++------------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/include/xmloff/txtstyli.hxx b/include/xmloff/txtstyli.hxx index bfcd7fc03f51..3b7cb23ba4c0 100644 --- a/include/xmloff/txtstyli.hxx +++ b/include/xmloff/txtstyli.hxx @@ -53,7 +53,7 @@ private: // Introduce import of empty list style (#i69523#) bool mbListStyleSet : 1; - XMLEventsImportContext* pEventContext; + css::uno::Reference mxEventContext; protected: @@ -69,7 +69,6 @@ public: const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList, SvXMLStylesContext& rStyles, sal_uInt16 nFamily, bool bDefaultStyle = false ); - virtual ~XMLTextStyleContext(); virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx index 5564408560ce..f6036990b8af 100644 --- a/xmloff/source/text/txtstyli.cxx +++ b/xmloff/source/text/txtstyli.cxx @@ -146,11 +146,6 @@ XMLTextStyleContext::XMLTextStyleContext( SvXMLImport& rImport, , bHasCombinedCharactersLetter( false ) // Inherited paragraph style lost information about unset numbering (#i69523#) , mbListStyleSet( false ) -, pEventContext( nullptr ) -{ -} - -XMLTextStyleContext::~XMLTextStyleContext() { } @@ -192,10 +187,9 @@ SvXMLImportContext *XMLTextStyleContext::CreateChildContext( { // create and remember events import context // (for delayed processing of events) - pEventContext = new XMLEventsImportContext( GetImport(), nPrefix, - rLocalName); - pEventContext->AddFirstRef(); - pContext = pEventContext; + mxEventContext.set(new XMLEventsImportContext( GetImport(), nPrefix, + rLocalName)); + pContext = mxEventContext.get(); } if( !pContext ) @@ -230,12 +224,12 @@ void XMLTextStyleContext::CreateAndInsert( bool bOverwrite ) } // tell the style about it's events (if applicable) - if (nullptr != pEventContext) + if (mxEventContext.is()) { // set event suppplier and release reference to context Reference xEventsSupplier(xStyle,UNO_QUERY); - pEventContext->SetEvents(xEventsSupplier); - pEventContext->ReleaseRef(); + mxEventContext->SetEvents(xEventsSupplier); + mxEventContext.clear(); } // XML import: reconstrution of assignment of paragraph style to outline levels (#i69629#)