summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2018-04-15 21:49:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-16 08:25:20 +0200
commit3a4d2468a62363dd228b1e2fad683baf81817674 (patch)
treeda3005daff924eb5f3abb6f5e7cc0c8ef64b5741 /toolkit
parent58aab71b34327e71b27287b59b9e1d652bf316c3 (diff)
toolkit: use thread safe static initializer
instead of two double-checked locking patterns Change-Id: Ic232ff44abcba6beda3edf385c2fc6029c04d936 Reviewed-on: https://gerrit.libreoffice.org/52922 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/awt/vclxprinter.cxx41
1 files changed, 7 insertions, 34 deletions
diff --git a/toolkit/source/awt/vclxprinter.cxx b/toolkit/source/awt/vclxprinter.cxx
index 7afe226f98de..9f982059e362 100644
--- a/toolkit/source/awt/vclxprinter.cxx
+++ b/toolkit/source/awt/vclxprinter.cxx
@@ -41,28 +41,6 @@
#define PROPERTY_Orientation 0
#define PROPERTY_Horizontal 1
-css::beans::Property* ImplGetProperties( sal_uInt16& rElementCount )
-{
- static css::beans::Property* pProperties = nullptr;
- static sal_uInt16 nElements = 0;
- if( !pProperties )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !pProperties )
- {
- static css::beans::Property aPropTable[] =
- {
- css::beans::Property( "Orientation", PROPERTY_Orientation, cppu::UnoType<sal_Int16>::get(), 0 ),
- css::beans::Property( "Horizontal", PROPERTY_Horizontal, cppu::UnoType<bool>::get(), 0 )
- };
- pProperties = aPropTable;
- nElements = SAL_N_ELEMENTS( aPropTable );
- }
- }
- rElementCount = nElements;
- return pProperties;
-}
-
// ----------------------------------------------------
// class VCLXPrinterPropertySet
// ----------------------------------------------------
@@ -105,18 +83,13 @@ css::uno::Reference< css::beans::XPropertySetInfo > VCLXPrinterPropertySet::getP
::cppu::IPropertyArrayHelper& VCLXPrinterPropertySet::getInfoHelper()
{
- static ::cppu::OPropertyArrayHelper* pPropertyArrayHelper = nullptr;
- if ( !pPropertyArrayHelper )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !pPropertyArrayHelper )
- {
- sal_uInt16 nElements;
- css::beans::Property* pProps = ImplGetProperties( nElements );
- pPropertyArrayHelper = new ::cppu::OPropertyArrayHelper( pProps, nElements, false );
- }
- }
- return *pPropertyArrayHelper ;
+ static ::cppu::OPropertyArrayHelper s_PropertyArrayHelper(
+ css::uno::Sequence<css::beans::Property>{
+ css::beans::Property( "Orientation", PROPERTY_Orientation, cppu::UnoType<sal_Int16>::get(), 0 ),
+ css::beans::Property( "Horizontal", PROPERTY_Horizontal, cppu::UnoType<bool>::get(), 0 )},
+ false);
+
+ return s_PropertyArrayHelper;
}
sal_Bool VCLXPrinterPropertySet::convertFastPropertyValue( css::uno::Any & rConvertedValue, css::uno::Any & rOldValue, sal_Int32 nHandle, const css::uno::Any& rValue )