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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 2 20:19:05 UTC 2020


 connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx  |    7 +++----
 connectivity/source/drivers/mozab/bootstrap/mozbootstrap.component |    2 +-
 connectivity/source/drivers/postgresql/postgresql-sdbc.component   |    2 +-
 connectivity/source/drivers/postgresql/pq_driver.cxx               |    7 ++-----
 4 files changed, 7 insertions(+), 11 deletions(-)

New commits:
commit 7b10b64b0701f1609e04aa13ac551858984b7cdf
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Oct 2 14:28:41 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Oct 2 22:18:22 2020 +0200

    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 at redhat.com>

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


More information about the Libreoffice-commits mailing list