diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-10-02 14:28:41 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-10-02 22:18:22 +0200 |
commit | 7b10b64b0701f1609e04aa13ac551858984b7cdf (patch) | |
tree | 8a658036f93c07c05fa48f1a0d5a70e74b8ae2e9 /connectivity | |
parent | ae9fe9d7107b2e25c9316033651e49c08537c0e9 (diff) |
Use the new single-instance="true" attribute in connectivity
Change-Id: I0572af758a98f2b417b35960403778c8cb2edcaf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103857
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'connectivity')
4 files changed, 7 insertions, 11 deletions
diff --git a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx index 62bea4e8f253..71cb17b0f4ec 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx @@ -21,7 +21,7 @@ #include <cppuhelper/factory.hxx> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <cppuhelper/supportsservice.hxx> -#include <rtl/ref.hxx> +#include <cppuhelper/weak.hxx> #include "MMozillaBootstrap.hxx" #include "MNSProfileDiscover.hxx" @@ -132,9 +132,8 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* connectivity_moz_MozillaBootstrap_get_implementation( css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - static rtl::Reference<MozillaBootstrap> pMozillaBootstrap(new connectivity::mozab::MozillaBootstrap()); - pMozillaBootstrap->acquire(); - return static_cast<cppu::OWeakObject*>(pMozillaBootstrap.get()); + return cppu::acquire( + static_cast<cppu::OWeakObject*>(new connectivity::mozab::MozillaBootstrap())); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component b/connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component index 11b58c134ba8..bfc0afe389ef 100644 --- a/connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component +++ b/connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component @@ -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.mozilla.MozillaBootstrap" - constructor="connectivity_moz_MozillaBootstrap_get_implementation"> + constructor="connectivity_moz_MozillaBootstrap_get_implementation" single-instance="true"> <service name="com.sun.star.mozilla.MozillaBootstrap"/> </implementation> </component> diff --git a/connectivity/source/drivers/postgresql/postgresql-sdbc.component b/connectivity/source/drivers/postgresql/postgresql-sdbc.component index 0a10aa77b826..a14ab2c96fea 100644 --- a/connectivity/source/drivers/postgresql/postgresql-sdbc.component +++ b/connectivity/source/drivers/postgresql/postgresql-sdbc.component @@ -11,7 +11,7 @@ <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="org.openoffice.comp.connectivity.pq.Driver.noext" - constructor="connectivity_pq_sdbc_driver_get_implementation"> + constructor="connectivity_pq_sdbc_driver_get_implementation" single-instance="true"> <service name="com.sun.star.sdbc.Driver"/> </implementation> </component> diff --git a/connectivity/source/drivers/postgresql/pq_driver.cxx b/connectivity/source/drivers/postgresql/pq_driver.cxx index e96d12c1a61f..87eb5682a2b2 100644 --- a/connectivity/source/drivers/postgresql/pq_driver.cxx +++ b/connectivity/source/drivers/postgresql/pq_driver.cxx @@ -35,8 +35,8 @@ ************************************************************************/ #include <cppuhelper/supportsservice.hxx> +#include <cppuhelper/weak.hxx> #include <com/sun/star/lang/XSingleComponentFactory.hpp> -#include <rtl/ref.hxx> #include "pq_driver.hxx" @@ -143,10 +143,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* connectivity_pq_sdbc_driver_get_implementation( css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) { - static rtl::Reference<pq_sdbc_driver::Driver> g_Driver(new pq_sdbc_driver::Driver(context)); - - g_Driver->acquire(); - return static_cast<cppu::OWeakObject*>(g_Driver.get()); + return cppu::acquire(static_cast<cppu::OWeakObject*>(new pq_sdbc_driver::Driver(context))); } |