diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-12-17 08:49:30 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-12-17 08:50:52 +0100 |
commit | 550d95ae6e67a3a0fdbee27ce92712d203383c3e (patch) | |
tree | 4e76e473a28e25f205a4b74a81c5628a7b3195bc /sw | |
parent | bb9a7c340d9d4a61def8064bfcb287b35bf6354c (diff) |
Manage m_pSttNdIdx via unique_ptr
...so it gets deleted upon an exception
Change-Id: I239f916019806eef1b761248fd167f5febf25001
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/xml/xmlimp.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlimp.hxx | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 127726796d06..9a34e8f00b28 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -398,7 +398,6 @@ SwXMLImport::SwXMLImport( const uno::Reference< uno::XComponentContext >& rContext, OUString const & implementationName, SvXMLImportFlags nImportFlags) : SvXMLImport( rContext, implementationName, nImportFlags ), - m_pSttNdIdx( nullptr ), m_pTableItemMapper( nullptr ), m_pDocElemTokenMap( nullptr ), m_pTableElemTokenMap( nullptr ), @@ -653,7 +652,7 @@ void SwXMLImport::startDocument() if( (getImportFlags() & SvXMLImportFlags::CONTENT) && !IsStylesOnlyMode() ) { - m_pSttNdIdx = new SwNodeIndex( pDoc->GetNodes() ); + m_pSttNdIdx.reset(new SwNodeIndex( pDoc->GetNodes() )); if( IsInsertMode() ) { SwPaM *pPaM = pTextCursor->GetPaM(); @@ -861,8 +860,7 @@ void SwXMLImport::endDocument() GetTextImport()->ResetCursor(); - delete m_pSttNdIdx; - m_pSttNdIdx = nullptr; + m_pSttNdIdx.reset();; // SJ: #i49801# -> now permitting repaints if ( pDoc ) diff --git a/sw/source/filter/xml/xmlimp.hxx b/sw/source/filter/xml/xmlimp.hxx index ab6227d5a785..fd8caf41c041 100644 --- a/sw/source/filter/xml/xmlimp.hxx +++ b/sw/source/filter/xml/xmlimp.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_SW_SOURCE_FILTER_XML_XMLIMP_HXX #define INCLUDED_SW_SOURCE_FILTER_XML_XMLIMP_HXX +#include <sal/config.h> + +#include <memory> + #include <com/sun/star/document/XDocumentProperties.hpp> #include <sot/storage.hxx> @@ -49,7 +53,7 @@ namespace SwImport { class SwXMLImport: public SvXMLImport { - SwNodeIndex *m_pSttNdIdx; + std::unique_ptr<SwNodeIndex> m_pSttNdIdx; SvXMLUnitConverter *m_pTwipUnitConv; SvXMLImportItemMapper *m_pTableItemMapper;// paragraph item import |