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

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


 scaddins/source/datefunc/date.component   |    2 +-
 scaddins/source/datefunc/datefunc.cxx     |    6 ++----
 scaddins/source/pricing/pricing.component |    2 +-
 scaddins/source/pricing/pricing.cxx       |    6 ++----
 4 files changed, 6 insertions(+), 10 deletions(-)

New commits:
commit df1fb2f78b4e979d90a3b9b7459c16eb13024a1a
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Oct 2 14:20:21 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Oct 2 20:42:05 2020 +0200

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

diff --git a/scaddins/source/datefunc/date.component b/scaddins/source/datefunc/date.component
index db67781e1476..7337d98c9388 100644
--- a/scaddins/source/datefunc/date.component
+++ b/scaddins/source/datefunc/date.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.sheet.addin.DateFunctionsImpl"
-    constructor="scaddins_ScaDateAddIn_get_implementation">
+    constructor="scaddins_ScaDateAddIn_get_implementation" single-instance="true">
     <service name="com.sun.star.sheet.AddIn"/>
     <service name="com.sun.star.sheet.addin.DateFunctions"/>
   </implementation>
diff --git a/scaddins/source/datefunc/datefunc.cxx b/scaddins/source/datefunc/datefunc.cxx
index d4c1921d13f0..995db6235300 100644
--- a/scaddins/source/datefunc/datefunc.cxx
+++ b/scaddins/source/datefunc/datefunc.cxx
@@ -23,9 +23,9 @@
 #include <com/sun/star/util/Date.hpp>
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/weak.hxx>
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
 #include <rtl/ustrbuf.hxx>
-#include <rtl/ref.hxx>
 #include <unotools/resmgr.hxx>
 #include <i18nlangtag/languagetag.hxx>
 #include <algorithm>
@@ -91,9 +91,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 scaddins_ScaDateAddIn_get_implementation(
     css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
 {
-    static rtl::Reference<ScaDateAddIn> g_Instance(new ScaDateAddIn());
-    g_Instance->acquire();
-    return static_cast<cppu::OWeakObject*>(g_Instance.get());
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(new ScaDateAddIn()));
 }
 
 
diff --git a/scaddins/source/pricing/pricing.component b/scaddins/source/pricing/pricing.component
index fcee10771c70..fbabf1fb6243 100644
--- a/scaddins/source/pricing/pricing.component
+++ b/scaddins/source/pricing/pricing.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.sheet.addin.PricingFunctionsImpl"
-    constructor="scaddins_ScaPricingAddIn_get_implementation">
+    constructor="scaddins_ScaPricingAddIn_get_implementation" single-instance="true">
     <service name="com.sun.star.sheet.AddIn"/>
     <service name="com.sun.star.sheet.addin.PricingFunctions"/>
   </implementation>
diff --git a/scaddins/source/pricing/pricing.cxx b/scaddins/source/pricing/pricing.cxx
index 6cbb13256464..569e396c43da 100644
--- a/scaddins/source/pricing/pricing.cxx
+++ b/scaddins/source/pricing/pricing.cxx
@@ -29,11 +29,11 @@
 
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/weak.hxx>
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
 #include <iostream>
 #include <algorithm>
 #include <rtl/math.hxx>
-#include <rtl/ref.hxx>
 #include <unotools/resmgr.hxx>
 #include <i18nlangtag/languagetag.hxx>
 
@@ -93,9 +93,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 scaddins_ScaPricingAddIn_get_implementation(
     css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
 {
-    static rtl::Reference<ScaPricingAddIn> g_Instance(new ScaPricingAddIn());
-    g_Instance->acquire();
-    return static_cast<cppu::OWeakObject*>(g_Instance.get());
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(new ScaPricingAddIn()));
 }
 
 //  "normal" service implementation


More information about the Libreoffice-commits mailing list