summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-02-11 08:54:17 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-02-11 08:54:50 +0100
commited21ac627cecc7dd7f416462beb6cf099889e79f (patch)
treee2268ff95772c7ea560e9b6abaaad525b6751dd2 /unotools
parent5152c43109c9a35f30fc9b0f478c1fbaf01a1143 (diff)
OTempFileService: avoid manually deleting mpTempFile
Change-Id: Ic2f83fd4ff83795a77dd9b97b98e2635e5c447c0
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/ucbhelper/XTempFile.hxx3
-rw-r--r--unotools/source/ucbhelper/xtempfile.cxx13
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);
}
}