toolkit/source/awt/vclxprinter.cxx | 41 ++++++------------------------------- 1 file changed, 7 insertions(+), 34 deletions(-)
New commits: commit 3a4d2468a62363dd228b1e2fad683baf81817674 Author: Jochen Nitschke <j.nitschke+loger...@ok.de> Date: Sun Apr 15 21:49:35 2018 +0200 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 <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> 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 ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits