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

Noel Grandin noel.grandin at collabora.co.uk
Thu Jun 21 06:20:53 UTC 2018


 forms/source/richtext/rtattributes.hxx |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 517c070d0642756fcef58214385407af603e22b6
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jun 20 15:14:48 2018 +0200

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

diff --git a/forms/source/richtext/rtattributes.hxx b/forms/source/richtext/rtattributes.hxx
index 6f79286f653f..6c166b240bbf 100644
--- a/forms/source/richtext/rtattributes.hxx
+++ b/forms/source/richtext/rtattributes.hxx
@@ -43,7 +43,7 @@ namespace frm
     struct AttributeState
     {
     private:
-        SfxPoolItem     *pItemHandleItem;
+        std::unique_ptr<SfxPoolItem>  pItemHandleItem;
 
     public:
         AttributeCheckState eSimpleState;
@@ -91,17 +91,15 @@ namespace frm
 
     inline const SfxPoolItem* AttributeState::getItem() const
     {
-        return pItemHandleItem;
+        return pItemHandleItem.get();
     }
 
     inline void AttributeState::setItem( const SfxPoolItem* _pItem )
     {
-        if ( pItemHandleItem )
-            delete pItemHandleItem;
         if ( _pItem )
-            pItemHandleItem = _pItem->Clone();
+            pItemHandleItem.reset(_pItem->Clone());
         else
-            pItemHandleItem = nullptr;
+            pItemHandleItem.reset();
     }
 
     inline bool AttributeState::operator==( const AttributeState& _rRHS )


More information about the Libreoffice-commits mailing list