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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jul 25 06:47:49 UTC 2018


 sw/source/uibase/inc/srcview.hxx    |    2 +-
 sw/source/uibase/inc/uivwimp.hxx    |    6 +++---
 sw/source/uibase/uiview/srcview.cxx |    9 ++++-----
 sw/source/uibase/uiview/uivwimp.cxx |   10 ++++------
 4 files changed, 12 insertions(+), 15 deletions(-)

New commits:
commit 36f8b5ec35440fa0b1dadadf28ce9d1a83f8dc50
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Jul 24 11:31:56 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 25 08:47:37 2018 +0200

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

diff --git a/sw/source/uibase/inc/srcview.hxx b/sw/source/uibase/inc/srcview.hxx
index 298983510f4d..60b866371352 100644
--- a/sw/source/uibase/inc/srcview.hxx
+++ b/sw/source/uibase/inc/srcview.hxx
@@ -34,7 +34,7 @@ class SwSrcView: public SfxViewShell
 {
     VclPtr<SwSrcEditWindow> aEditWin;
 
-    SvxSearchItem*      pSearchItem;
+    std::unique_ptr<SvxSearchItem> pSearchItem;
 
     bool                bSourceSaved    :1;
     rtl_TextEncoding    eLoadEncoding;
diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx
index 5aefb75da632..7160f1ec66cb 100644
--- a/sw/source/uibase/uiview/srcview.cxx
+++ b/sw/source/uibase/uiview/srcview.cxx
@@ -234,7 +234,7 @@ SwSrcView::~SwSrcView()
     pDocShell->SetAutoLoad(INetURLObject(url), delay,
                             (delay != 0) || !url.isEmpty());
     EndListening(*pDocShell);
-    delete pSearchItem;
+    pSearchItem.reset();
 
     aEditWin.disposeAndClear();
 }
@@ -548,15 +548,14 @@ SvxSearchItem* SwSrcView::GetSearchItem()
 {
     if(!pSearchItem)
     {
-        pSearchItem = new SvxSearchItem(SID_SEARCH_ITEM);
+        pSearchItem.reset(new SvxSearchItem(SID_SEARCH_ITEM));
     }
-    return pSearchItem;
+    return pSearchItem.get();
 }
 
 void SwSrcView::SetSearchItem( const SvxSearchItem& rItem )
 {
-    delete pSearchItem;
-    pSearchItem = static_cast<SvxSearchItem*>(rItem.Clone());
+    pSearchItem.reset(static_cast<SvxSearchItem*>(rItem.Clone()));
 }
 
 void SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem,
commit 97c993b681bb059d1974b29ade5b433f93a85e46
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Jul 24 11:30:09 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 25 08:47:22 2018 +0200

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

diff --git a/sw/source/uibase/inc/uivwimp.hxx b/sw/source/uibase/inc/uivwimp.hxx
index 46b627c518b7..67c90d732ea9 100644
--- a/sw/source/uibase/inc/uivwimp.hxx
+++ b/sw/source/uibase/inc/uivwimp.hxx
@@ -104,8 +104,8 @@ class SwView_Impl
     std::shared_ptr<SwMailMergeConfigItem>
                                 xConfigItem;
 
-    sfx2::DocumentInserter*     m_pDocInserter;
-    SfxRequest*                 m_pRequest;
+    std::unique_ptr<sfx2::DocumentInserter> m_pDocInserter;
+    std::unique_ptr<SfxRequest>             m_pRequest;
     sal_Int16                   m_nParam;
 
     Point                       m_aEditingPosition;
@@ -162,7 +162,7 @@ public:
     SfxMedium*              CreateMedium();
     void                    InitRequest( const SfxRequest& rRequest );
 
-    SfxRequest*      GetRequest() const { return m_pRequest; }
+    SfxRequest*      GetRequest() const { return m_pRequest.get(); }
     sal_Int16        GetParam() const { return m_nParam; }
     void             SetParam( sal_Int16 nParam ) { m_nParam = nParam; }
 };
diff --git a/sw/source/uibase/uiview/uivwimp.cxx b/sw/source/uibase/uiview/uivwimp.cxx
index 70d688111a4b..f626480715e1 100644
--- a/sw/source/uibase/uiview/uivwimp.cxx
+++ b/sw/source/uibase/uiview/uivwimp.cxx
@@ -87,8 +87,8 @@ SwView_Impl::~SwView_Impl()
 #if HAVE_FEATURE_DBCONNECTIVITY
     xConfigItem.reset();
 #endif
-    delete m_pDocInserter;
-    delete m_pRequest;
+    m_pDocInserter.reset();
+    m_pRequest.reset();
 }
 
 void SwView_Impl::SetShellMode(ShellMode eSet)
@@ -261,8 +261,7 @@ void SwView_Impl::StartDocumentInserter(
             break;
     }
 
-    delete m_pDocInserter;
-    m_pDocInserter = new ::sfx2::DocumentInserter(pView->GetFrameWeld(), rFactory, mode);
+    m_pDocInserter.reset(new ::sfx2::DocumentInserter(pView->GetFrameWeld(), rFactory, mode));
     m_pDocInserter->StartExecuteModal( rEndDialogHdl );
 }
 
@@ -273,8 +272,7 @@ SfxMedium* SwView_Impl::CreateMedium()
 
 void SwView_Impl::InitRequest( const SfxRequest& rRequest )
 {
-    delete m_pRequest;
-    m_pRequest = new SfxRequest( rRequest );
+    m_pRequest.reset(new SfxRequest( rRequest ));
 }
 
 SwScannerEventListener::~SwScannerEventListener()


More information about the Libreoffice-commits mailing list