diff options
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/ucbhelper/XTempFile.hxx | 3 | ||||
-rw-r--r-- | unotools/source/ucbhelper/xtempfile.cxx | 13 |
2 files changed, 5 insertions, 11 deletions
diff --git a/unotools/source/ucbhelper/XTempFile.hxx b/unotools/source/ucbhelper/XTempFile.hxx index 5d54883bfeb8..f50aeea3c98e 100644 --- a/unotools/source/ucbhelper/XTempFile.hxx +++ b/unotools/source/ucbhelper/XTempFile.hxx @@ -19,6 +19,7 @@ #ifndef INCLUDED_UNOTOOLS_SOURCE_UCBHELPER_XTEMPFILE_HXX #define INCLUDED_UNOTOOLS_SOURCE_UCBHELPER_XTEMPFILE_HXX +#include <memory> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/io/XSeekable.hpp> @@ -44,7 +45,7 @@ class OTempFileService : public OTempFileBase , public ::cppu::PropertySetMixin< css::io::XTempFile > { protected: - ::utl::TempFile* mpTempFile; + std::unique_ptr<utl::TempFile> mpTempFile; ::osl::Mutex maMutex; SvStream* mpStream; bool mbRemoveFile; diff --git a/unotools/source/ucbhelper/xtempfile.cxx b/unotools/source/ucbhelper/xtempfile.cxx index 888ee864c850..e0afe6b107e5 100644 --- a/unotools/source/ucbhelper/xtempfile.cxx +++ b/unotools/source/ucbhelper/xtempfile.cxx @@ -39,13 +39,12 @@ OTempFileService::OTempFileService(css::uno::Reference< css::uno::XComponentCont , mbHasCachedPos( false ) { - mpTempFile = new ::utl::TempFile; + mpTempFile.reset(new utl::TempFile()); mpTempFile->EnableKillingFile(); } OTempFileService::~OTempFileService () { - delete mpTempFile; } // XInterface @@ -248,10 +247,7 @@ throw ( css::io::NotConnectedException, css::io::IOException, css::uno::RuntimeE mpStream = nullptr; if ( mpTempFile ) - { - delete mpTempFile; - mpTempFile = nullptr; - } + mpTempFile.reset(nullptr); } } @@ -307,10 +303,7 @@ throw ( css::io::NotConnectedException, css::io::BufferSizeExceededException, cs mpStream = nullptr; if ( mpTempFile ) - { - delete mpTempFile; - mpTempFile = nullptr; - } + mpTempFile.reset(nullptr); } } |