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

Noel (via logerrit) logerrit at kemper.freedesktop.org
Sat Feb 20 18:22:19 UTC 2021


 starmath/source/AccessibleSmElement.cxx         |   10 ++++------
 starmath/source/AccessibleSmElementsControl.cxx |    9 ++++-----
 starmath/source/accessibility.cxx               |   14 +++++---------
 3 files changed, 13 insertions(+), 20 deletions(-)

New commits:
commit 7c992bd895574eb1faf473875f8e655e9b73cb79
Author:     Noel <noel.grandin at collabora.co.uk>
AuthorDate: Sat Feb 20 12:49:48 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Feb 20 19:21:34 2021 +0100

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

diff --git a/starmath/source/AccessibleSmElement.cxx b/starmath/source/AccessibleSmElement.cxx
index 848af8af6b0d..30d19cc8afc3 100644
--- a/starmath/source/AccessibleSmElement.cxx
+++ b/starmath/source/AccessibleSmElement.cxx
@@ -168,17 +168,15 @@ uno::Reference<XAccessibleRelationSet> AccessibleSmElement::getAccessibleRelatio
 {
     OContextEntryGuard aGuard(this);
 
-    utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
-    uno::Reference<XAccessibleRelationSet> xSet = pRelationSetHelper;
-    return xSet;
+    return new utl::AccessibleRelationSetHelper;
 }
 
 uno::Reference<XAccessibleStateSet> AccessibleSmElement::getAccessibleStateSet()
 {
     OExternalLockGuard aGuard(this);
 
-    utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
-    uno::Reference<XAccessibleStateSet> xStateSet = pStateSetHelper;
+    rtl::Reference<utl::AccessibleStateSetHelper> pStateSetHelper
+        = new utl::AccessibleStateSetHelper;
 
     if (m_pSmElementsControl && !rBHelper.bDisposed && !rBHelper.bInDispose)
     {
@@ -199,7 +197,7 @@ uno::Reference<XAccessibleStateSet> AccessibleSmElement::getAccessibleStateSet()
     else
         pStateSetHelper->AddState(AccessibleStateType::DEFUNC);
 
-    return xStateSet;
+    return pStateSetHelper;
 }
 
 // XAccessibleComponent
diff --git a/starmath/source/AccessibleSmElementsControl.cxx b/starmath/source/AccessibleSmElementsControl.cxx
index 0b82f3f87e5a..922c8097fd6a 100644
--- a/starmath/source/AccessibleSmElementsControl.cxx
+++ b/starmath/source/AccessibleSmElementsControl.cxx
@@ -192,7 +192,8 @@ uno::Reference<XAccessible> AccessibleSmElementsControl::getAccessibleChild(sal_
     if (!xChild.is())
     {
         sal_uInt16 nHighlightItemId = m_pControl->itemHighlighted();
-        AccessibleSmElement* pChild = new AccessibleSmElement(m_pControl, nItemId, c);
+        rtl::Reference<AccessibleSmElement> pChild
+            = new AccessibleSmElement(m_pControl, nItemId, c);
         if (pChild->itemId() == nHighlightItemId)
             pChild->SetFocus(true);
         m_aAccessibleChildren[c] = pChild;
@@ -342,9 +343,7 @@ uno::Reference<XAccessibleRelationSet> AccessibleSmElementsControl::getAccessibl
 uno::Reference<XAccessibleStateSet> AccessibleSmElementsControl::getAccessibleStateSet()
 {
     SolarMutexGuard aGuard;
-    ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper;
-
-    uno::Reference<XAccessibleStateSet> xStateSet(pStateSet);
+    rtl::Reference<::utl::AccessibleStateSetHelper> pStateSet = new ::utl::AccessibleStateSetHelper;
 
     if (!m_pControl)
         pStateSet->AddState(AccessibleStateType::DEFUNC);
@@ -364,7 +363,7 @@ uno::Reference<XAccessibleStateSet> AccessibleSmElementsControl::getAccessibleSt
             pStateSet->AddState(AccessibleStateType::OPAQUE);
     }
 
-    return xStateSet;
+    return pStateSet;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx
index efc6bc691043..851f122c5ad5 100644
--- a/starmath/source/accessibility.cxx
+++ b/starmath/source/accessibility.cxx
@@ -337,11 +337,9 @@ Reference< XAccessibleRelationSet > SAL_CALL SmGraphicAccessible::getAccessibleR
 Reference< XAccessibleStateSet > SAL_CALL SmGraphicAccessible::getAccessibleStateSet()
 {
     SolarMutexGuard aGuard;
-    ::utl::AccessibleStateSetHelper *pStateSet =
+    rtl::Reference<::utl::AccessibleStateSetHelper> pStateSet =
             new ::utl::AccessibleStateSetHelper;
 
-    Reference<XAccessibleStateSet> xStateSet( pStateSet );
-
     if (!pWin)
         pStateSet->AddState( AccessibleStateType::DEFUNC );
     else
@@ -360,7 +358,7 @@ Reference< XAccessibleStateSet > SAL_CALL SmGraphicAccessible::getAccessibleStat
             pStateSet->AddState( AccessibleStateType::OPAQUE );
     }
 
-    return xStateSet;
+    return pStateSet;
 }
 
 Locale SAL_CALL SmGraphicAccessible::getLocale()
@@ -703,7 +701,7 @@ sal_Bool SAL_CALL SmGraphicAccessible::copyText(
     {
         OUString sText( getTextRange(nStartIndex, nEndIndex) );
 
-        vcl::unohelper::TextDataObject* pDataObj = new vcl::unohelper::TextDataObject( sText );
+        rtl::Reference<vcl::unohelper::TextDataObject> pDataObj = new vcl::unohelper::TextDataObject( sText );
         SolarMutexReleaser aReleaser;
         xClipboard->setContents( pDataObj, nullptr );
 
@@ -1717,11 +1715,9 @@ uno::Reference< XAccessibleRelationSet > SAL_CALL SmEditAccessible::getAccessibl
 uno::Reference< XAccessibleStateSet > SAL_CALL SmEditAccessible::getAccessibleStateSet(  )
 {
     SolarMutexGuard aGuard;
-    ::utl::AccessibleStateSetHelper *pStateSet =
+    rtl::Reference<::utl::AccessibleStateSetHelper> pStateSet =
             new ::utl::AccessibleStateSetHelper;
 
-    Reference<XAccessibleStateSet> xStateSet( pStateSet );
-
     if (!pWin || !pTextHelper)
         pStateSet->AddState( AccessibleStateType::DEFUNC );
     else
@@ -1742,7 +1738,7 @@ uno::Reference< XAccessibleStateSet > SAL_CALL SmEditAccessible::getAccessibleSt
             pStateSet->AddState( AccessibleStateType::OPAQUE );
     }
 
-    return xStateSet;
+    return pStateSet;
 }
 
 Locale SAL_CALL SmEditAccessible::getLocale(  )


More information about the Libreoffice-commits mailing list