Use the new single-instance="true" attribute in eventattacher

Change-Id: Iea414a641d252f7af40ebcabb6f11222fe81dd45
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103854
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2020-10-02 14:25:15 +02:00
parent 8c8b6c6ab7
commit 95969a8030
2 changed files with 2 additions and 5 deletions

View File

@ -40,7 +40,6 @@
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <rtl/ref.hxx>
namespace com::sun::star::lang { class XMultiServiceFactory; }
@ -843,9 +842,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
eventattacher_EventAttacher(
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
{
static rtl::Reference<comp_EventAttacher::EventAttacherImpl> instance(new comp_EventAttacher::EventAttacherImpl(context));
instance->acquire();
return static_cast<cppu::OWeakObject*>(instance.get());
return cppu::acquire(static_cast<cppu::OWeakObject*>(new comp_EventAttacher::EventAttacherImpl(context)));
}

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="com.sun.star.comp.EventAttacher"
constructor="eventattacher_EventAttacher">
constructor="eventattacher_EventAttacher" single-instance="true">
<service name="com.sun.star.script.EventAttacher"/>
</implementation>
</component>