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@redhat.com>
This commit is contained in:
Stephan Bergmann 2020-10-02 14:23:42 +02:00
parent 1be81c0ae6
commit cf7638fd05
8 changed files with 12 additions and 16 deletions

View file

@ -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>

View file

@ -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()));
}

View file

@ -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>

View file

@ -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: */

View file

@ -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>

View file

@ -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()));
}

View file

@ -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>

View file

@ -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: */