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

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


 lingucomponent/source/hyphenator/hyphen/hyphen.component           |    2 +-
 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx              |    5 ++---
 lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component |    2 +-
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm        |    5 ++---
 lingucomponent/source/spellcheck/spell/spell.component             |    2 +-
 lingucomponent/source/spellcheck/spell/sspellimp.cxx               |    5 ++---
 lingucomponent/source/thesaurus/libnth/lnth.component              |    2 +-
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx                |    5 ++---
 8 files changed, 12 insertions(+), 16 deletions(-)

New commits:
commit cf7638fd051773efcc78ea9610030354d4d15665
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Oct 2 14:23:42 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Oct 2 20:43:22 2020 +0200

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

diff --git a/lingucomponent/source/hyphenator/hyphen/hyphen.component b/lingucomponent/source/hyphenator/hyphen/hyphen.component
index 0d775423dd5c..b9bc8b1f36ca 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphen.component
+++ b/lingucomponent/source/hyphenator/hyphen/hyphen.component
@@ -20,7 +20,7 @@
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
     xmlns="http://openoffice.org/2010/uno-components">
   <implementation name="org.openoffice.lingu.LibHnjHyphenator"
-    constructor="lingucomponent_Hyphenator_get_implementation">
+    constructor="lingucomponent_Hyphenator_get_implementation" single-instance="true">
     <service name="com.sun.star.linguistic2.Hyphenator"/>
   </implementation>
 </component>
diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index 8c7d09ac66e6..988306757a96 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -22,6 +22,7 @@
 #include <comphelper/sequence.hxx>
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/weak.hxx>
 #include <com/sun/star/registry/XRegistryKey.hpp>
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
 #include <com/sun/star/linguistic2/XLinguProperties.hpp>
@@ -803,9 +804,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 lingucomponent_Hyphenator_get_implementation(
     css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
 {
-    static rtl::Reference<Hyphenator> g_Instance(new Hyphenator());
-    g_Instance->acquire();
-    return static_cast<cppu::OWeakObject*>(g_Instance.get());
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(new Hyphenator()));
 }
 
 
diff --git a/lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component b/lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component
index f318df2abfec..b1fe7d612aa8 100644
--- a/lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component
+++ b/lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component
@@ -20,7 +20,7 @@
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
     xmlns="http://openoffice.org/2010/uno-components">
   <implementation name="org.openoffice.lingu.MacOSXSpellChecker"
-    constructor="lingucomponent_MacSpellChecker_get_implementation">
+    constructor="lingucomponent_MacSpellChecker_get_implementation" single-instance="true">
     <service name="com.sun.star.linguistic2.SpellChecker"/>
   </implementation>
 </component>
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index c3f64635e071..74b365c71746 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -23,6 +23,7 @@
 #include <com/sun/star/linguistic2/XLinguProperties.hpp>
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/weak.hxx>
 #include <com/sun/star/registry/XRegistryKey.hpp>
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
 #include <tools/debug.hxx>
@@ -634,9 +635,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 lingucomponent_MacSpellChecker_get_implementation(
     css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
 {
-    static rtl::Reference<MacSpellChecker> g_Instance(new MacSpellChecker());
-    g_Instance->acquire();
-    return static_cast<cppu::OWeakObject*>(g_Instance.get());
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(new MacSpellChecker()));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lingucomponent/source/spellcheck/spell/spell.component b/lingucomponent/source/spellcheck/spell/spell.component
index 59f634eab02a..c284e13fc3a7 100644
--- a/lingucomponent/source/spellcheck/spell/spell.component
+++ b/lingucomponent/source/spellcheck/spell/spell.component
@@ -20,7 +20,7 @@
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
     xmlns="http://openoffice.org/2010/uno-components">
   <implementation name="org.openoffice.lingu.MySpellSpellChecker"
-    constructor="lingucomponent_SpellChecker_get_implementation">
+    constructor="lingucomponent_SpellChecker_get_implementation" single-instance="true">
     <service name="com.sun.star.linguistic2.SpellChecker"/>
   </implementation>
 </component>
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 23bd9e014c29..051b29c60d4e 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -25,6 +25,7 @@
 #include <comphelper/processfactory.hxx>
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/weak.hxx>
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/registry/XRegistryKey.hpp>
@@ -635,9 +636,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 lingucomponent_SpellChecker_get_implementation(
     css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
 {
-    static rtl::Reference<SpellChecker> g_Instance(new SpellChecker());
-    g_Instance->acquire();
-    return static_cast<cppu::OWeakObject*>(g_Instance.get());
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(new SpellChecker()));
 }
 
 
diff --git a/lingucomponent/source/thesaurus/libnth/lnth.component b/lingucomponent/source/thesaurus/libnth/lnth.component
index dfe3d3300cbc..66e90e2cf231 100644
--- a/lingucomponent/source/thesaurus/libnth/lnth.component
+++ b/lingucomponent/source/thesaurus/libnth/lnth.component
@@ -20,7 +20,7 @@
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
     xmlns="http://openoffice.org/2010/uno-components">
   <implementation name="org.openoffice.lingu.new.Thesaurus"
-    constructor="lingucomponent_Thesaurus_get_implementation">
+    constructor="lingucomponent_Thesaurus_get_implementation" single-instance="true">
     <service name="com.sun.star.linguistic2.Thesaurus"/>
   </implementation>
 </component>
diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
index a8b32bd4727f..2c9bfb196917 100644
--- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
+++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
@@ -20,6 +20,7 @@
 #include <com/sun/star/uno/Reference.h>
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/weak.hxx>
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
 #include <com/sun/star/registry/XRegistryKey.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
@@ -570,9 +571,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 lingucomponent_Thesaurus_get_implementation(
     css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
 {
-    static rtl::Reference<Thesaurus> g_Instance(new Thesaurus());
-    g_Instance->acquire();
-    return static_cast<cppu::OWeakObject*>(g_Instance.get());
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(new Thesaurus()));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list