diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-06-26 12:17:27 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-06-26 14:19:36 +0200 |
commit | f5e2dbb40cab1a21dc972806ee4038f52843e838 (patch) | |
tree | 9a31eebd39107bd4d84c262e786548ec831af392 /sax/inc/xml2utf.hxx | |
parent | coverity#1437526 Unchecked return value (diff) | |
download | core-f5e2dbb40cab1a21dc972806ee4038f52843e838.tar.gz core-f5e2dbb40cab1a21dc972806ee4038f52843e838.zip |
Avoid potential double-delete in ~XMLFile2UTFConverter
...as the implicitly defined copy operations would just copy the m_p* member
pointers. Needed some modification of the ParserCleanup class so that Entity
(which has a XMLFile2UTFConverter member) can be std::move'd into
SaxExpatParser_Impl::pushEntity.
Found by new -Wdeprecated-copy of GCC trunk towards GCC 9.
Change-Id: I0cb5b5dbcd55249b475ed74b4ac6bcb12f20f2c6
Reviewed-on: https://gerrit.libreoffice.org/56453
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sax/inc/xml2utf.hxx')
-rw-r--r-- | sax/inc/xml2utf.hxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sax/inc/xml2utf.hxx b/sax/inc/xml2utf.hxx index 0a26c1f81482..3e6d09cda3a0 100644 --- a/sax/inc/xml2utf.hxx +++ b/sax/inc/xml2utf.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_SAX_INC_XML2UTF_HXX #define INCLUDED_SAX_INC_XML2UTF_HXX +#include <sal/config.h> + +#include <memory> + #include <sal/types.h> namespace sax_expatwrap { @@ -73,13 +77,9 @@ class XMLFile2UTFConverter { public: XMLFile2UTFConverter( ): - m_bStarted( false ), - m_pText2Unicode( nullptr ), - m_pUnicode2Text( nullptr ) + m_bStarted( false ) {} - ~XMLFile2UTFConverter(); - void setInputStream( css::uno::Reference< css::io::XInputStream > const &r ) { m_in = r; } void setEncoding( const OString &s ) { m_sEncoding = s; } @@ -116,8 +116,8 @@ private: bool m_bStarted; OString m_sEncoding; - Text2UnicodeConverter *m_pText2Unicode; - Unicode2TextConverter *m_pUnicode2Text; + std::unique_ptr<Text2UnicodeConverter> m_pText2Unicode; + std::unique_ptr<Unicode2TextConverter> m_pUnicode2Text; }; } |