[Libreoffice-commits] core.git: svtools/source

Takeshi Abe tabe at fixedpoint.jp
Thu Oct 26 06:54:03 UTC 2017


 svtools/source/filter/exportdialog.cxx |    7 +++----
 svtools/source/filter/exportdialog.hxx |    3 ++-
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 4130a5c4b07b5d440d05ab7df0d593373cd76044
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Thu Oct 26 06:39:42 2017 +0900

    Fix memory leak
    
    Change-Id: I2638a8440601264ff00221ead28a71c891abae16
    Reviewed-on: https://gerrit.libreoffice.org/43860
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx
index c1d6138a6ea4..7f6d7652de77 100644
--- a/svtools/source/filter/exportdialog.cxx
+++ b/svtools/source/filter/exportdialog.cxx
@@ -400,8 +400,7 @@ void ExportDialog::GetGraphicStream()
 {
     if ( !IsTempExportAvailable() )
     {
-        delete mpTempStream;
-        mpTempStream = new SvMemoryStream();
+        mpTempStream.reset(new SvMemoryStream());
         maBitmap = Bitmap();
         return;
     }
@@ -419,8 +418,7 @@ void ExportDialog::GetGraphicStream()
     {
         if ( bRecreateOutputStream )
         {
-            delete mpTempStream;
-            mpTempStream = new SvMemoryStream();
+            mpTempStream.reset(new SvMemoryStream());
             maBitmap = Bitmap();
 
             uno::Reference< graphic::XGraphic > xGraphic;
@@ -1012,6 +1010,7 @@ ExportDialog::~ExportDialog()
 
 void ExportDialog::dispose()
 {
+    mpTempStream.reset();
     delete mpFilterOptionsItem;
     delete mpOptionsItem;
     mpMfSizeX.clear();
diff --git a/svtools/source/filter/exportdialog.hxx b/svtools/source/filter/exportdialog.hxx
index 5c50660cb2e5..b8bf28321f1e 100644
--- a/svtools/source/filter/exportdialog.hxx
+++ b/svtools/source/filter/exportdialog.hxx
@@ -34,6 +34,7 @@
 #include <com/sun/star/drawing/XShape.hpp>
 #include <com/sun/star/drawing/XShapes.hpp>
 #include <com/sun/star/drawing/XDrawPage.hpp>
+#include <memory>
 
 /*************************************************************************
 |*
@@ -118,7 +119,7 @@ private:
     sal_Int16           mnFormat;
     sal_Int32           mnMaxFilesizeForRealtimePreview;
 
-    SvMemoryStream*     mpTempStream;
+    std::unique_ptr<SvMemoryStream> mpTempStream;
     Bitmap              maBitmap;
 
     css::awt::Size      maOriginalSize;     // the original graphic size in 1/100mm


More information about the Libreoffice-commits mailing list