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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 2 18:43:39 UTC 2020


 linguistic/source/dlistimp.cxx   |    5 ++---
 linguistic/source/gciterator.cxx |    6 ++----
 linguistic/source/lng.component  |    8 ++++----
 linguistic/source/lngopt.cxx     |    6 ++----
 linguistic/source/lngsvcmgr.cxx  |    5 ++---
 5 files changed, 12 insertions(+), 18 deletions(-)

New commits:
commit 1be81c0ae66fdb4a92ca9b4fe6691958da838866
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Oct 2 14:22:55 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Oct 2 20:42:52 2020 +0200

    Use the new single-instance="true" attribute in linguistic
    
    Change-Id: I87343e3760d3e583fc6b6ad55028e51bd402b536
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103851
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index 03c576a820f4..3fa38b38d4a5 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -26,6 +26,7 @@
 #include <tools/urlobj.hxx>
 #include <unotools/useroptions.hxx>
 #include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/weak.hxx>
 #include <unotools/localfilehelper.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/sequence.hxx>
@@ -784,9 +785,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 linguistic_DicList_get_implementation(
     css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
 {
-    static rtl::Reference<DicList> g_Instance(new DicList());
-    g_Instance->acquire();
-    return static_cast<cppu::OWeakObject*>(g_Instance.get());
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(new DicList()));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 45c13b1cfe72..19864c9d8035 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -48,12 +48,12 @@
 #include <osl/conditn.hxx>
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/weak.hxx>
 #include <i18nlangtag/languagetag.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/propertysequence.hxx>
 #include <tools/debug.hxx>
 #include <tools/diagnose_ex.h>
-#include <rtl/ref.hxx>
 
 #include <map>
 
@@ -1174,9 +1174,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 linguistic_GrammarCheckingIterator_get_implementation(
     css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
 {
-    static rtl::Reference<GrammarCheckingIterator> g_Instance(new GrammarCheckingIterator());
-    g_Instance->acquire();
-    return static_cast<cppu::OWeakObject*>(g_Instance.get());
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(new GrammarCheckingIterator()));
 }
 
 
diff --git a/linguistic/source/lng.component b/linguistic/source/lng.component
index 525e02cd93e7..82622e2f005f 100644
--- a/linguistic/source/lng.component
+++ b/linguistic/source/lng.component
@@ -24,19 +24,19 @@
     <service name="com.sun.star.linguistic2.ConversionDictionaryList"/>
   </implementation>
   <implementation name="com.sun.star.lingu2.DicList"
-    constructor="linguistic_DicList_get_implementation">
+    constructor="linguistic_DicList_get_implementation" single-instance="true">
     <service name="com.sun.star.linguistic2.DictionaryList"/>
   </implementation>
   <implementation name="com.sun.star.lingu2.LinguProps"
-    constructor="linguistic_LinguProps_get_implementation">
+    constructor="linguistic_LinguProps_get_implementation" single-instance="true">
     <service name="com.sun.star.linguistic2.LinguProperties"/>
   </implementation>
   <implementation name="com.sun.star.lingu2.LngSvcMgr"
-    constructor="linguistic_LngSvcMgr_get_implementation">
+    constructor="linguistic_LngSvcMgr_get_implementation" single-instance="true">
     <service name="com.sun.star.linguistic2.LinguServiceManager"/>
   </implementation>
   <implementation name="com.sun.star.lingu2.ProofreadingIterator"
-    constructor="linguistic_GrammarCheckingIterator_get_implementation">
+    constructor="linguistic_GrammarCheckingIterator_get_implementation" single-instance="true">
     <service name="com.sun.star.linguistic2.ProofreadingIterator"/>
   </implementation>
 </component>
diff --git a/linguistic/source/lngopt.cxx b/linguistic/source/lngopt.cxx
index f82124ecc07a..290b6581f8dc 100644
--- a/linguistic/source/lngopt.cxx
+++ b/linguistic/source/lngopt.cxx
@@ -23,11 +23,11 @@
 #include <linguistic/misc.hxx>
 #include <tools/debug.hxx>
 #include <unotools/lingucfg.hxx>
-#include <rtl/ref.hxx>
 
 #include <comphelper/sequence.hxx>
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/weak.hxx>
 #include <com/sun/star/lang/Locale.hpp>
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
 
@@ -427,9 +427,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 linguistic_LinguProps_get_implementation(
     css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
 {
-    static rtl::Reference<LinguProps> g_Instance(new LinguProps());
-    g_Instance->acquire();
-    return static_cast<cppu::OWeakObject*>(g_Instance.get());
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(new LinguProps()));
 }
 
 
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 5f25749da164..23a2e2c7cac7 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -42,6 +42,7 @@
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/weak.hxx>
 
 #include "lngsvcmgr.hxx"
 #include <linguistic/misc.hxx>
@@ -1837,9 +1838,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 linguistic_LngSvcMgr_get_implementation(
     css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
 {
-    static rtl::Reference<LngSvcMgr> g_Instance(new LngSvcMgr());
-    g_Instance->acquire();
-    return static_cast<cppu::OWeakObject*>(g_Instance.get());
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(new LngSvcMgr()));
 }
 
 


More information about the Libreoffice-commits mailing list