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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Sat Aug 10 21:00:32 UTC 2019


 lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx |    5 +-
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm  |   21 ++++-------
 2 files changed, 11 insertions(+), 15 deletions(-)

New commits:
commit 91e4d876098aaa7ac18a03e20cbc2789fba98041
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Sat Aug 10 19:43:29 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Sat Aug 10 22:59:52 2019 +0200

    Combine MacSpellChecker p/xPropHelper
    
    Change-Id: Ie5b5ea4863ce39f53ab4ebe2e02dc7ed141627ba
    Reviewed-on: https://gerrit.libreoffice.org/77248
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
index e26d353455fe..a750a849144e 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
@@ -70,8 +70,7 @@ class MacSpellChecker :
     UITextChecker *         pChecker;
 #endif
     ::comphelper::OInterfaceContainerHelper2       aEvtListeners;
-    Reference< XPropertyChangeListener >    xPropHelper;
-    linguistic::PropertyHelper_Spell *      pPropHelper;
+    rtl::Reference< linguistic::PropertyHelper_Spell >    xPropHelper;
     bool                                    bDisposing;
 
     MacSpellChecker(const MacSpellChecker &) = delete;
@@ -80,7 +79,7 @@ class MacSpellChecker :
     linguistic::PropertyHelper_Spell &  GetPropHelper_Impl();
     linguistic::PropertyHelper_Spell &  GetPropHelper()
     {
-        return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
+        return xPropHelper.is() ? *xPropHelper.get() : GetPropHelper_Impl();
     }
 
     sal_Int16   GetSpellFailure( const OUString &rWord, const Locale &rLocale );
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 4c97ead10acb..31af179f4eaf 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -52,7 +52,6 @@ MacSpellChecker::MacSpellChecker() :
     aDLocs = nullptr;
     aDNames = nullptr;
     bDisposing = false;
-    pPropHelper = nullptr;
     numdict = 0;
 #ifndef IOS
     NSApplicationLoad();
@@ -74,22 +73,21 @@ MacSpellChecker::~MacSpellChecker()
   aDLocs = nullptr;
   if (aDNames) delete[] aDNames;
   aDNames = nullptr;
-  if (pPropHelper)
-     pPropHelper->RemoveAsPropListener();
+  if (xPropHelper.is())
+     xPropHelper->RemoveAsPropListener();
 }
 
 
 PropertyHelper_Spell & MacSpellChecker::GetPropHelper_Impl()
 {
-    if (!pPropHelper)
+    if (!xPropHelper.is())
     {
         Reference< XLinguProperties >   xPropSet( GetLinguProperties() );
 
-        pPropHelper = new PropertyHelper_Spell( static_cast<XSpellChecker *>(this), xPropSet );
-        xPropHelper = pPropHelper;
-        pPropHelper->AddAsPropListener();   //! after a reference is established
+        xPropHelper = new PropertyHelper_Spell( static_cast<XSpellChecker *>(this), xPropSet );
+        xPropHelper->AddAsPropListener();
     }
-    return *pPropHelper;
+    return *xPropHelper.get();
 }
 
 
@@ -570,7 +568,7 @@ void SAL_CALL
 {
     MutexGuard  aGuard( GetLinguMutex() );
 
-    if (!pPropHelper)
+    if (!xPropHelper.is())
     {
         sal_Int32 nLen = rArguments.getLength();
         if (2 == nLen)
@@ -583,9 +581,8 @@ void SAL_CALL
             //! And the reference to the UNO-functions while increasing
             //! the ref-count and will implicitly free the memory
             //! when the object is no longer used.
-            pPropHelper = new PropertyHelper_Spell( static_cast<XSpellChecker *>(this), xPropSet );
-            xPropHelper = pPropHelper;
-            pPropHelper->AddAsPropListener();   //! after a reference is established
+            xPropHelper = new PropertyHelper_Spell( static_cast<XSpellChecker *>(this), xPropSet );
+            xPropHelper->AddAsPropListener();
         }
         else
             OSL_FAIL( "wrong number of arguments in sequence" );


More information about the Libreoffice-commits mailing list