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

Noel Grandin noel.grandin at collabora.co.uk
Thu May 3 06:23:19 UTC 2018


 svx/inc/svdibrow.hxx           |    4 ++--
 svx/source/svdraw/svdibrow.cxx |    7 +++----
 2 files changed, 5 insertions(+), 6 deletions(-)

New commits:
commit c3a8dc07be1beeccbefb9242a1fd1f270cb531ba
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed May 2 10:36:41 2018 +0200

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

diff --git a/svx/inc/svdibrow.hxx b/svx/inc/svdibrow.hxx
index 21104c99829d..e735cee9db59 100644
--- a/svx/inc/svdibrow.hxx
+++ b/svx/inc/svdibrow.hxx
@@ -39,7 +39,7 @@ friend class ImpItemEdit;
     OUString aWNameMemorized;
     Link<SdrItemBrowserControl&,void> aEntryChangedHdl;
     Link<SdrItemBrowserControl&,void> aSetDirtyHdl;
-    ImpItemListRow* pCurrentChangeEntry;
+    std::unique_ptr<ImpItemListRow> pCurrentChangeEntry;
     long   nLastWhichOfs;
     sal_uInt16 nLastWhich;
     bool bWhichesButNames;
@@ -83,7 +83,7 @@ public:
     */
     virtual OUString  GetCellText(long _nRow, sal_uInt16 _nColId) const override;
 
-    const ImpItemListRow* GetCurrentChangeEntry() const { return pCurrentChangeEntry; }
+    const ImpItemListRow* GetCurrentChangeEntry() const { return pCurrentChangeEntry.get(); }
     OUString GetNewEntryValue() const                 { return pEditControl->GetText(); }
     void SetEntryChangedHdl(const Link<SdrItemBrowserControl&,void>& rLink)    { aEntryChangedHdl=rLink; }
     void SetSetDirtyHdl(const Link<SdrItemBrowserControl&,void>& rLink)        { aSetDirtyHdl=rLink; }
diff --git a/svx/source/svdraw/svdibrow.cxx b/svx/source/svdraw/svdibrow.cxx
index 0128792cfc4e..b8976cfa12c4 100644
--- a/svx/source/svdraw/svdibrow.cxx
+++ b/svx/source/svdraw/svdibrow.cxx
@@ -220,7 +220,7 @@ void SdrItemBrowserControl::dispose()
 {
     pEditControl.disposeAndClear();
 
-    delete pCurrentChangeEntry;
+    pCurrentChangeEntry.reset();
 
     Clear();
     BrowseBox::dispose();
@@ -501,7 +501,7 @@ bool SdrItemBrowserControl::BeginChangeEntry(std::size_t nPos)
         }
         aNewName += " - Type 'del' to reset to default.";
         pParent->SetText(aNewName);
-        pCurrentChangeEntry=new ImpItemListRow(*pEntry);
+        pCurrentChangeEntry.reset(new ImpItemListRow(*pEntry));
         bRet = true;
     }
     return bRet;
@@ -520,8 +520,7 @@ void SdrItemBrowserControl::BreakChangeEntry()
 {
     if (pEditControl!=nullptr) {
         pEditControl.disposeAndClear();
-        delete pCurrentChangeEntry;
-        pCurrentChangeEntry=nullptr;
+        pCurrentChangeEntry.reset();
         vcl::Window* pParent=GetParent();
         pParent->SetText(aWNameMemorized);
         SetMode(MYBROWSEMODE);


More information about the Libreoffice-commits mailing list