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

Noel (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 2 19:46:41 UTC 2021


 toolkit/inc/controls/geometrycontrolmodel.hxx      |    7 ++++---
 toolkit/inc/controls/geometrycontrolmodel_impl.hxx |    2 +-
 toolkit/source/controls/geometrycontrolmodel.cxx   |   10 ++++------
 3 files changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 81cacf8dea7ca2fb7b0d6e86b36b9f9568ff849d
Author:     Noel <noel.grandin at collabora.co.uk>
AuthorDate: Mon Mar 1 20:37:24 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Mar 2 20:45:51 2021 +0100

    loplugin:refcounting in toolkit
    
    Change-Id: I7564951f3e3fdc0554de9a4af3833bc4f0facce0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111770
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/toolkit/inc/controls/geometrycontrolmodel.hxx b/toolkit/inc/controls/geometrycontrolmodel.hxx
index 2d87f7cca2af..600e9592046f 100644
--- a/toolkit/inc/controls/geometrycontrolmodel.hxx
+++ b/toolkit/inc/controls/geometrycontrolmodel.hxx
@@ -27,6 +27,7 @@
 #include <com/sun/star/util/XCloneable.hpp>
 #include <com/sun/star/script/XScriptEventsSupplier.hpp>
 #include <comphelper/IdPropArrayHelper.hxx>
+#include <rtl/ref.hxx>
 
 namespace com::sun::star::resource { class XStringResourceResolver; }
 
@@ -144,7 +145,7 @@ namespace com::sun::star {
             SAL_CALL getEvents(  ) override;
 
         // XCloneable implementation - to be overwritten
-        virtual OGeometryControlModel_Base* createClone_Impl(
+        virtual rtl::Reference<OGeometryControlModel_Base> createClone_Impl(
             css::uno::Reference< css::util::XCloneable >& _rxAggregateInstance) = 0;
 
         // XComponent
@@ -190,7 +191,7 @@ namespace com::sun::star {
         virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
 
         // OGeometryControlModel_Base
-        virtual OGeometryControlModel_Base* createClone_Impl(
+        virtual rtl::Reference<OGeometryControlModel_Base> createClone_Impl(
             css::uno::Reference< css::util::XCloneable >& _rxAggregateInstance) override;
 
         // XTypeProvider
@@ -230,7 +231,7 @@ namespace com::sun::star {
         virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
 
         // OGeometryControlModel_Base
-        virtual OGeometryControlModel_Base* createClone_Impl(
+        virtual rtl::Reference<OGeometryControlModel_Base> createClone_Impl(
             css::uno::Reference< css::util::XCloneable >& _rxAggregateInstance) override;
 
         // XTypeProvider
diff --git a/toolkit/inc/controls/geometrycontrolmodel_impl.hxx b/toolkit/inc/controls/geometrycontrolmodel_impl.hxx
index 37a3983f6888..2ec8595dddf1 100644
--- a/toolkit/inc/controls/geometrycontrolmodel_impl.hxx
+++ b/toolkit/inc/controls/geometrycontrolmodel_impl.hxx
@@ -60,7 +60,7 @@ css::uno::Sequence<sal_Int8> SAL_CALL OGeometryControlModel<CONTROLMODEL>::getIm
 }
 
 template <class CONTROLMODEL>
-OGeometryControlModel_Base* OGeometryControlModel<CONTROLMODEL>::createClone_Impl(
+rtl::Reference<OGeometryControlModel_Base> OGeometryControlModel<CONTROLMODEL>::createClone_Impl(
     css::uno::Reference<css::util::XCloneable>& _rxAggregateInstance)
 {
     return new OGeometryControlModel<CONTROLMODEL>(_rxAggregateInstance);
diff --git a/toolkit/source/controls/geometrycontrolmodel.cxx b/toolkit/source/controls/geometrycontrolmodel.cxx
index be4e4ffce065..eb21d49bc07f 100644
--- a/toolkit/source/controls/geometrycontrolmodel.cxx
+++ b/toolkit/source/controls/geometrycontrolmodel.cxx
@@ -372,7 +372,7 @@
         OSL_ENSURE(xAggregateClone.is(), "OGeometryControlModel_Base::createClone: suspicious return of the aggregate!");
 
         // create a new wrapper aggregating this return value
-        OGeometryControlModel_Base* pOwnClone = createClone_Impl(xAggregateClone);
+        rtl::Reference<OGeometryControlModel_Base> pOwnClone = createClone_Impl(xAggregateClone);
         OSL_ENSURE(pOwnClone, "OGeometryControlModel_Base::createClone: invalid derivee behaviour!");
         OSL_ENSURE(!xAggregateClone.is(), "OGeometryControlModel_Base::createClone: invalid ctor behaviour!");
             // should have been reset
@@ -391,13 +391,11 @@
         // Clone event container
         Reference< css::script::XScriptEventsSupplier > xEventsSupplier =
             static_cast< css::script::XScriptEventsSupplier* >( this );
-        Reference< css::script::XScriptEventsSupplier > xCloneEventsSupplier =
-            static_cast< css::script::XScriptEventsSupplier* >( pOwnClone );
 
-        if( xEventsSupplier.is() && xCloneEventsSupplier.is() )
+        if( xEventsSupplier.is() )
         {
             Reference< XNameContainer > xEventCont = xEventsSupplier->getEvents();
-            Reference< XNameContainer > xCloneEventCont = xCloneEventsSupplier->getEvents();
+            Reference< XNameContainer > xCloneEventCont = pOwnClone->getEvents();
 
             const css::uno::Sequence< OUString > aNames =
                 xEventCont->getElementNames();
@@ -561,7 +559,7 @@
     }
 
 
-    OGeometryControlModel_Base* OCommonGeometryControlModel::createClone_Impl( Reference< XCloneable >& _rxAggregateInstance )
+    rtl::Reference<OGeometryControlModel_Base> OCommonGeometryControlModel::createClone_Impl( Reference< XCloneable >& _rxAggregateInstance )
     {
         return new OCommonGeometryControlModel( _rxAggregateInstance, m_sServiceSpecifier );
     }


More information about the Libreoffice-commits mailing list