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

Noel Grandin noel.grandin at collabora.co.uk
Mon Feb 19 06:11:58 UTC 2018


 include/svx/AccessibleShape.hxx              |    5 +++--
 svx/source/accessibility/AccessibleShape.cxx |   18 ++++++++----------
 svx/source/form/navigatortreemodel.cxx       |    4 ++--
 svx/source/inc/fmexpl.hxx                    |    5 +++--
 4 files changed, 16 insertions(+), 16 deletions(-)

New commits:
commit d3c7a7807695deee35e40ef6d77a7428682525d3
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Feb 6 13:27:25 2018 +0200

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

diff --git a/include/svx/AccessibleShape.hxx b/include/svx/AccessibleShape.hxx
index 592a7ead9b32..71842073ffdf 100644
--- a/include/svx/AccessibleShape.hxx
+++ b/include/svx/AccessibleShape.hxx
@@ -48,6 +48,7 @@
 #include <svx/AccessibleShapeTreeInfo.hxx>
 #include <svx/IAccessibleViewForwarderListener.hxx>
 #include <svx/svxdllapi.h>
+#include <memory>
 
 namespace com { namespace sun { namespace star {
     namespace accessibility { class XAccessible; }
@@ -373,7 +374,7 @@ public:
 
 protected:
     /// Children manager. May be empty if there are no children.
-    ChildrenManager* mpChildrenManager;
+    std::unique_ptr<ChildrenManager> mpChildrenManager;
 
     /// Reference to the actual shape.
     css::uno::Reference<
@@ -389,7 +390,7 @@ protected:
 
     /** The accessible text engine.  May be NULL if it can not be created.
     */
-    AccessibleTextHelper* mpText;
+    std::unique_ptr<AccessibleTextHelper> mpText;
 
     /** This object can be used to modify the child list of our parent.
     */
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx
index 810fa68dbc3d..cd3a84889f86 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -118,8 +118,8 @@ AccessibleShape::AccessibleShape (
 
 AccessibleShape::~AccessibleShape()
 {
-    delete mpChildrenManager;
-    delete mpText;
+    mpChildrenManager.reset();
+    mpText.reset();
     SAL_INFO("svx", "~AccessibleShape");
 
     // Unregistering from the various broadcasters should be unnecessary
@@ -135,8 +135,8 @@ void AccessibleShape::Init()
     // Create a children manager when this shape has children of its own.
     Reference<drawing::XShapes> xShapes (mxShape, uno::UNO_QUERY);
     if (xShapes.is() && xShapes->getCount() > 0)
-        mpChildrenManager = new ChildrenManager (
-            this, xShapes, maShapeTreeInfo, *this);
+        mpChildrenManager.reset( new ChildrenManager (
+            this, xShapes, maShapeTreeInfo, *this) );
     if (mpChildrenManager != nullptr)
         mpChildrenManager->Update();
 
@@ -174,12 +174,12 @@ void AccessibleShape::Init()
                 if( !pOutlinerParaObject )
                 {
                     // empty text -> use proxy edit source to delay creation of EditEngine
-                    mpText = new AccessibleTextHelper( o3tl::make_unique<AccessibleEmptyEditSource >(*pSdrObject, *pView, *pWindow) );
+                    mpText.reset( new AccessibleTextHelper( o3tl::make_unique<AccessibleEmptyEditSource >(*pSdrObject, *pView, *pWindow) ) );
                 }
                 else
                 {
                     // non-empty text -> use full-fledged edit source right away
-                    mpText = new AccessibleTextHelper( o3tl::make_unique<SvxTextEditSource >(*pSdrObject, nullptr, *pView, *pWindow) );
+                    mpText.reset( new AccessibleTextHelper( o3tl::make_unique<SvxTextEditSource >(*pSdrObject, nullptr, *pView, *pWindow) ) );
                 }
                 if( pWindow->HasFocus() )
                     mpText->SetFocus();
@@ -1195,14 +1195,12 @@ void AccessibleShape::disposing()
     // Release the child containers.
     if (mpChildrenManager != nullptr)
     {
-        delete mpChildrenManager;
-        mpChildrenManager = nullptr;
+        mpChildrenManager.reset();
     }
     if (mpText != nullptr)
     {
         mpText->Dispose();
-        delete mpText;
-        mpText = nullptr;
+        mpText.reset();
     }
 
     // Cleanup.  Remove references to objects to allow them to be
commit cc0be9f9616b732955ff21850fb69142ee46507e
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Feb 6 11:41:51 2018 +0200

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

diff --git a/svx/source/form/navigatortreemodel.cxx b/svx/source/form/navigatortreemodel.cxx
index 2c7c717b39de..95a38b4f75a1 100644
--- a/svx/source/form/navigatortreemodel.cxx
+++ b/svx/source/form/navigatortreemodel.cxx
@@ -191,7 +191,7 @@ namespace svxform
                     ,m_pFormModel(nullptr)
     {
         m_pPropChangeList = new OFormComponentObserver(this);
-        m_pRootList = new FmEntryDataList();
+        m_pRootList.reset( new FmEntryDataList() );
     }
 
     NavigatorTreeModel::~NavigatorTreeModel()
@@ -209,7 +209,7 @@ namespace svxform
         }
 
         Clear();
-        delete m_pRootList;
+        m_pRootList.reset();
         m_pPropChangeList->ReleaseModel();
     }
 
diff --git a/svx/source/inc/fmexpl.hxx b/svx/source/inc/fmexpl.hxx
index 76142653fe7a..0d01abb9e2e9 100644
--- a/svx/source/inc/fmexpl.hxx
+++ b/svx/source/inc/fmexpl.hxx
@@ -316,7 +316,8 @@ namespace svxform
         friend class NavigatorTree;
         friend class OFormComponentObserver;
 
-        FmEntryDataList*            m_pRootList;
+        std::unique_ptr<FmEntryDataList>
+                                    m_pRootList;
         FmFormShell*                m_pFormShell;
         FmFormPage*                 m_pFormPage;
         FmFormModel*                m_pFormModel;
@@ -361,7 +362,7 @@ namespace svxform
         FmFormPage*         GetFormPage() const { return m_pFormPage; }
         FmEntryData*        FindData( const css::uno::Reference< css::uno::XInterface >& xElement, FmEntryDataList* pDataList, bool bRecurs=true );
         FmEntryData*        FindData( const OUString& rText, FmFormData const * pParentData, bool bRecurs );
-        FmEntryDataList*    GetRootList() const { return m_pRootList; }
+        FmEntryDataList*    GetRootList() const { return m_pRootList.get(); }
         static css::uno::Reference< css::container::XIndexContainer >   GetFormComponents( FmFormData const * pParentFormData );
 
         virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;


More information about the Libreoffice-commits mailing list