summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-07-09 17:10:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-07-10 08:30:21 +0200
commit65e41592a650887c8d00586385119effa54de5fa (patch)
tree4b0f6c7f52159d9cf70c561c815f623d3b57198d /include
parentacb7c06ab171d4201842d8183eefeeca2d28c3f5 (diff)
pass SvStream around by std::unique_ptr
and give utl::OStreamWrapper a new constructor so that it knows it is taking ownership of the SvStream, which appears to fix several leaks Change-Id: Idcbcca9b81a4f0345fd8b8c8a2f4e84213686a6b Reviewed-on: https://gerrit.libreoffice.org/57187 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r--include/svtools/embedhlp.hxx2
-rw-r--r--include/unotools/streamwrap.hxx3
-rw-r--r--include/unotools/ucbstreamhelper.hxx15
-rw-r--r--include/vcl/graphicfilter.hxx2
4 files changed, 13 insertions, 9 deletions
diff --git a/include/svtools/embedhlp.hxx b/include/svtools/embedhlp.hxx
index 30a5cdc6338e..27e3e89eb590 100644
--- a/include/svtools/embedhlp.hxx
+++ b/include/svtools/embedhlp.hxx
@@ -48,7 +48,7 @@ class SVT_DLLPUBLIC EmbeddedObjectRef
{
std::unique_ptr<EmbeddedObjectRef_Impl> mpImpl;
- SVT_DLLPRIVATE SvStream* GetGraphicStream( bool bUpdate ) const;
+ SVT_DLLPRIVATE std::unique_ptr<SvStream> GetGraphicStream( bool bUpdate ) const;
SVT_DLLPRIVATE void GetReplacement( bool bUpdate );
EmbeddedObjectRef& operator = ( const EmbeddedObjectRef& ) = delete;
diff --git a/include/unotools/streamwrap.hxx b/include/unotools/streamwrap.hxx
index 81f463ea6e2c..299b6dfd081f 100644
--- a/include/unotools/streamwrap.hxx
+++ b/include/unotools/streamwrap.hxx
@@ -29,6 +29,7 @@
#include <com/sun/star/io/XStream.hpp>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/implbase1.hxx>
+#include <memory>
class SvStream;
@@ -53,6 +54,7 @@ protected:
public:
OInputStreamWrapper(SvStream& _rStream);
OInputStreamWrapper(SvStream* pStream, bool bOwner=false);
+ OInputStreamWrapper(std::unique_ptr<SvStream> pStream);
virtual ~OInputStreamWrapper() override;
// css::io::XInputStream
@@ -152,6 +154,7 @@ protected:
public:
OStreamWrapper(SvStream& _rStream);
+ OStreamWrapper(std::unique_ptr<SvStream> _rStream);
// css::io::XStream
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getInputStream( ) override;
diff --git a/include/unotools/ucbstreamhelper.hxx b/include/unotools/ucbstreamhelper.hxx
index 68309d094acf..f037571fe212 100644
--- a/include/unotools/ucbstreamhelper.hxx
+++ b/include/unotools/ucbstreamhelper.hxx
@@ -25,6 +25,7 @@
#include <unotools/unotoolsdllapi.h>
#include <tools/stream.hxx>
+#include <memory>
namespace com
{
@@ -52,13 +53,13 @@ namespace utl
class UNOTOOLS_DLLPUBLIC UcbStreamHelper
{
public:
- static SvStream* CreateStream( const OUString& rFileName, StreamMode eOpenMode );
- static SvStream* CreateStream( const OUString& rFileName, StreamMode eOpenMode,
- bool bFileExists );
- static SvStream* CreateStream( const css::uno::Reference < css::io::XInputStream >& xStream );
- static SvStream* CreateStream( const css::uno::Reference < css::io::XStream >& xStream );
- static SvStream* CreateStream( const css::uno::Reference < css::io::XInputStream >& xStream, bool bCloseStream );
- static SvStream* CreateStream( const css::uno::Reference < css::io::XStream >& xStream, bool bCloseStream );
+ static std::unique_ptr<SvStream> CreateStream( const OUString& rFileName, StreamMode eOpenMode );
+ static std::unique_ptr<SvStream> CreateStream( const OUString& rFileName, StreamMode eOpenMode,
+ bool bFileExists );
+ static std::unique_ptr<SvStream> CreateStream( const css::uno::Reference < css::io::XInputStream >& xStream );
+ static std::unique_ptr<SvStream> CreateStream( const css::uno::Reference < css::io::XStream >& xStream );
+ static std::unique_ptr<SvStream> CreateStream( const css::uno::Reference < css::io::XInputStream >& xStream, bool bCloseStream );
+ static std::unique_ptr<SvStream> CreateStream( const css::uno::Reference < css::io::XStream >& xStream, bool bCloseStream );
};
}
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index 2f24cf10e085..8c5ce93221f2 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -285,7 +285,7 @@ public:
/// Imports multiple graphics.
///
/// The resulting graphic is added to rGraphics on success, nullptr is added on failure.
- void ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGraphics, const std::vector< std::shared_ptr<SvStream> >& rStreams);
+ void ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGraphics, std::vector< std::unique_ptr<SvStream> > vStreams);
ErrCode ImportGraphic( Graphic& rGraphic, const OUString& rPath,
SvStream& rStream,