[Libreoffice-commits] core.git: sw/inc sw/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Mar 22 06:34:37 UTC 2018


 sw/inc/accmap.hxx                |    4 ++--
 sw/source/core/access/accmap.cxx |    8 +++-----
 2 files changed, 5 insertions(+), 7 deletions(-)

New commits:
commit e1315724322e0bcacb9c8fe25e3385ebd94ed505
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Mar 20 09:04:30 2018 +0200

    loplugin:useuniqueptr in SwAccessibleMap
    
    Change-Id: I47b64b30123918fb0d8251ae7ba113775cfb3625
    Reviewed-on: https://gerrit.libreoffice.org/51664
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/inc/accmap.hxx b/sw/inc/accmap.hxx
index 975c01f559b9..5ed3fcfae7e3 100644
--- a/sw/inc/accmap.hxx
+++ b/sw/inc/accmap.hxx
@@ -104,7 +104,7 @@ class SwAccessibleMap : public ::accessibility::IAccessibleViewForwarder,
     SwViewShell *mpVSh;
     /// for page preview: store preview data, VisArea, and mapping of
     /// preview-to-display coordinates
-    SwAccPreviewData* mpPreview;
+    std::unique_ptr<SwAccPreviewData> mpPreview;
 
     css::uno::WeakReference < css::accessibility::XAccessible > mxCursorContext;
 
@@ -120,7 +120,7 @@ class SwAccessibleMap : public ::accessibility::IAccessibleViewForwarder,
     void InvalidateShapeSelection();
 
     //mpSelectedFrameMap contains the old selected objects.
-    SwAccessibleContextMap_Impl *mpSeletedFrameMap;
+    std::unique_ptr<SwAccessibleContextMap_Impl> mpSeletedFrameMap;
 
     OUString maDocName;
 
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 215985502de2..dbfa3a76f9a3 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -1361,7 +1361,7 @@ void SwAccessibleMap::InvalidateShapeInParaSelection()
         }
     }
     if( !mpSeletedFrameMap )
-        mpSeletedFrameMap = new SwAccessibleContextMap_Impl;
+        mpSeletedFrameMap.reset( new SwAccessibleContextMap_Impl );
     if( !mpSeletedFrameMap->empty() )
     {
         SwAccessibleContextMap_Impl::iterator aIter = mpSeletedFrameMap->begin();
@@ -1705,8 +1705,7 @@ SwAccessibleMap::~SwAccessibleMap()
         mpSelectedParas = nullptr;
     }
 
-    delete mpPreview;
-    mpPreview = nullptr;
+    mpPreview.reset();
 
     {
         osl::MutexGuard aGuard( maEventMutex );
@@ -1718,7 +1717,6 @@ SwAccessibleMap::~SwAccessibleMap()
         mpEvents = nullptr;
     }
     mpVSh->GetLayout()->RemoveAccessibleShell();
-    delete mpSeletedFrameMap;
 }
 
 uno::Reference< XAccessible > SwAccessibleMap::GetDocumentView_(
@@ -1796,7 +1794,7 @@ uno::Reference<XAccessible> SwAccessibleMap::GetDocumentPreview(
 {
     // create & update preview data object
     if( mpPreview == nullptr )
-        mpPreview = new SwAccPreviewData();
+        mpPreview.reset( new SwAccPreviewData() );
     mpPreview->Update( *this, _rPreviewPages, _rScale, _pSelectedPageFrame, _rPreviewWinSize );
 
     uno::Reference<XAccessible> xAcc = GetDocumentView_( true );


More information about the Libreoffice-commits mailing list