[Libreoffice-commits] core.git: avmedia/source chart2/source cppu/source dbaccess/source extensions/source forms/source svx/source toolkit/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sun Nov 4 10:50:19 UTC 2018
avmedia/source/framework/soundhandler.cxx | 35 +---
chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx | 26 +--
cppu/source/threadpool/current.cxx | 88 +++++-------
dbaccess/source/inc/apitools.hxx | 13 -
extensions/source/bibliography/framectr.cxx | 30 +---
extensions/source/propctrlr/eventhandler.cxx | 87 +++++------
forms/source/richtext/richtextmodel.cxx | 13 -
svx/source/table/tablecolumn.cxx | 76 ++++------
svx/source/table/tablerow.cxx | 76 ++++------
toolkit/source/controls/controlmodelcontainerbase.cxx | 14 -
10 files changed, 182 insertions(+), 276 deletions(-)
New commits:
commit a2058e7516a01167c2d20ed157500b38db967c64
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sun Nov 4 12:48:59 2018 +0300
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sun Nov 4 11:49:42 2018 +0100
replace double-checked locking patterns with thread safe local statics
Change-Id: Ie1aae7ecbd065a88b371d8c0deb586f54f7eff65
Reviewed-on: https://gerrit.libreoffice.org/62835
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/avmedia/source/framework/soundhandler.cxx b/avmedia/source/framework/soundhandler.cxx
index 70ed2f53c2dc..b004f7b52403 100644
--- a/avmedia/source/framework/soundhandler.cxx
+++ b/avmedia/source/framework/soundhandler.cxx
@@ -76,33 +76,14 @@ css::uno::Sequence< sal_Int8 > SAL_CALL SoundHandler::getImplementationId()
css::uno::Sequence< css::uno::Type > SAL_CALL SoundHandler::getTypes()
{
- /* Optimize this method ! */
- /* We initialize a static variable only one time. */
- /* And we don't must use a mutex at every call! */
- /* For the first call; pTypeCollection is NULL - */
- /* for the second call pTypeCollection is different from NULL! */
- static ::cppu::OTypeCollection* pTypeCollection = nullptr ;
- if ( pTypeCollection == nullptr )
- {
- /* Ready for multithreading; get global mutex for first call of this method only! see before */
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- /* Control these pointer again ... it can be, that another instance will be faster then these! */
- if ( pTypeCollection == nullptr )
- {
- /* Create a static typecollection ... */
- static ::cppu::OTypeCollection aTypeCollection
- (
- cppu::UnoType<css::lang::XTypeProvider>::get(),
- cppu::UnoType<css::lang::XServiceInfo>::get(),
- cppu::UnoType<css::frame::XNotifyingDispatch>::get(),
- cppu::UnoType<css::frame::XDispatch>::get(),
- cppu::UnoType<css::document::XExtendedFilterDetection>::get()
- );
- /* ... and set his address to static pointer! */
- pTypeCollection = &aTypeCollection ;
- }
- }
- return pTypeCollection->getTypes();
+ static ::cppu::OTypeCollection aTypeCollection(
+ cppu::UnoType<css::lang::XTypeProvider>::get(),
+ cppu::UnoType<css::lang::XServiceInfo>::get(),
+ cppu::UnoType<css::frame::XNotifyingDispatch>::get(),
+ cppu::UnoType<css::frame::XDispatch>::get(),
+ cppu::UnoType<css::document::XExtendedFilterDetection>::get());
+
+ return aTypeCollection.getTypes();
}
#define IMPLEMENTATIONNAME_SOUNDHANDLER OUString("com.sun.star.comp.framework.SoundHandler")
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
index 69004f9bc1c6..9606ae805c6f 100644
--- a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx
@@ -113,23 +113,15 @@ uno::Any SAL_CALL CreationWizardUnoDlg::queryAggregation( uno::Type const & rTyp
uno::Sequence< uno::Type > CreationWizardUnoDlg::getTypes()
{
- static uno::Sequence< uno::Type > aTypeList;
-
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !aTypeList.getLength() )
- {
- std::vector< uno::Type > aTypes;
- aTypes.push_back( cppu::UnoType<lang::XComponent>::get() );
- aTypes.push_back( cppu::UnoType<lang::XTypeProvider>::get() );
- aTypes.push_back( cppu::UnoType<uno::XAggregation>::get() );
- aTypes.push_back( cppu::UnoType<uno::XWeak>::get() );
- aTypes.push_back( cppu::UnoType<lang::XServiceInfo>::get() );
- aTypes.push_back( cppu::UnoType<lang::XInitialization>::get() );
- aTypes.push_back( cppu::UnoType<frame::XTerminateListener>::get() );
- aTypes.push_back( cppu::UnoType<ui::dialogs::XExecutableDialog>::get() );
- aTypes.push_back( cppu::UnoType<beans::XPropertySet>::get() );
- aTypeList = comphelper::containerToSequence( aTypes );
- }
+ static uno::Sequence<uno::Type> aTypeList{ cppu::UnoType<lang::XComponent>::get(),
+ cppu::UnoType<lang::XTypeProvider>::get(),
+ cppu::UnoType<uno::XAggregation>::get(),
+ cppu::UnoType<uno::XWeak>::get(),
+ cppu::UnoType<lang::XServiceInfo>::get(),
+ cppu::UnoType<lang::XInitialization>::get(),
+ cppu::UnoType<frame::XTerminateListener>::get(),
+ cppu::UnoType<ui::dialogs::XExecutableDialog>::get(),
+ cppu::UnoType<beans::XPropertySet>::get() };
return aTypeList;
}
diff --git a/cppu/source/threadpool/current.cxx b/cppu/source/threadpool/current.cxx
index ed8891fabf8f..cd769c046d3f 100644
--- a/cppu/source/threadpool/current.cxx
+++ b/cppu/source/threadpool/current.cxx
@@ -42,57 +42,43 @@ namespace cppu
static typelib_InterfaceTypeDescription * get_type_XCurrentContext()
{
- static typelib_InterfaceTypeDescription * s_type_XCurrentContext = nullptr;
- if (nullptr == s_type_XCurrentContext)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (nullptr == s_type_XCurrentContext)
- {
- OUString sTypeName("com.sun.star.uno.XCurrentContext");
- typelib_InterfaceTypeDescription * pTD = nullptr;
- typelib_TypeDescriptionReference * pMembers[1] = { nullptr };
- OUString sMethodName0("com.sun.star.uno.XCurrentContext::getValueByName");
- typelib_typedescriptionreference_new(
- &pMembers[0],
- typelib_TypeClass_INTERFACE_METHOD,
- sMethodName0.pData );
- typelib_typedescription_newInterface(
- &pTD,
- sTypeName.pData, 0, 0, 0, 0, 0,
- * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ),
- 1,
- pMembers );
-
- typelib_typedescription_register( reinterpret_cast<typelib_TypeDescription**>(&pTD) );
- typelib_typedescriptionreference_release( pMembers[0] );
-
- typelib_InterfaceMethodTypeDescription * pMethod = nullptr;
- typelib_Parameter_Init aParameters[1];
- OUString sParamName0("Name");
- OUString sParamType0("string");
- aParameters[0].pParamName = sParamName0.pData;
- aParameters[0].eTypeClass = typelib_TypeClass_STRING;
- aParameters[0].pTypeName = sParamType0.pData;
- aParameters[0].bIn = true;
- aParameters[0].bOut = false;
- rtl_uString * pExceptions[1];
- OUString sExceptionName0("com.sun.star.uno.RuntimeException");
- pExceptions[0] = sExceptionName0.pData;
- OUString sReturnType0("any");
- typelib_typedescription_newInterfaceMethod(
- &pMethod,
- 3, false,
- sMethodName0.pData,
- typelib_TypeClass_ANY, sReturnType0.pData,
- 1, aParameters, 1, pExceptions );
- typelib_typedescription_register( reinterpret_cast<typelib_TypeDescription**>(&pMethod) );
- typelib_typedescription_release( &pMethod->aBase.aBase );
- // another static ref:
- ++reinterpret_cast< typelib_TypeDescription * >( pTD )->
- nStaticRefCount;
- s_type_XCurrentContext = pTD;
- }
- }
+ static typelib_InterfaceTypeDescription* s_type_XCurrentContext = []() {
+ OUString sTypeName("com.sun.star.uno.XCurrentContext");
+ typelib_InterfaceTypeDescription* pTD = nullptr;
+ typelib_TypeDescriptionReference* pMembers[1] = { nullptr };
+ OUString sMethodName0("com.sun.star.uno.XCurrentContext::getValueByName");
+ typelib_typedescriptionreference_new(&pMembers[0], typelib_TypeClass_INTERFACE_METHOD,
+ sMethodName0.pData);
+ typelib_typedescription_newInterface(
+ &pTD, sTypeName.pData, 0, 0, 0, 0, 0,
+ *typelib_static_type_getByTypeClass(typelib_TypeClass_INTERFACE), 1, pMembers);
+
+ typelib_typedescription_register(reinterpret_cast<typelib_TypeDescription**>(&pTD));
+ typelib_typedescriptionreference_release(pMembers[0]);
+
+ typelib_InterfaceMethodTypeDescription* pMethod = nullptr;
+ typelib_Parameter_Init aParameters[1];
+ OUString sParamName0("Name");
+ OUString sParamType0("string");
+ aParameters[0].pParamName = sParamName0.pData;
+ aParameters[0].eTypeClass = typelib_TypeClass_STRING;
+ aParameters[0].pTypeName = sParamType0.pData;
+ aParameters[0].bIn = true;
+ aParameters[0].bOut = false;
+ rtl_uString* pExceptions[1];
+ OUString sExceptionName0("com.sun.star.uno.RuntimeException");
+ pExceptions[0] = sExceptionName0.pData;
+ OUString sReturnType0("any");
+ typelib_typedescription_newInterfaceMethod(&pMethod, 3, false, sMethodName0.pData,
+ typelib_TypeClass_ANY, sReturnType0.pData, 1,
+ aParameters, 1, pExceptions);
+ typelib_typedescription_register(reinterpret_cast<typelib_TypeDescription**>(&pMethod));
+ typelib_typedescription_release(&pMethod->aBase.aBase);
+ // another static ref:
+ ++reinterpret_cast<typelib_TypeDescription*>(pTD)->nStaticRefCount;
+ return pTD;
+ }();
+
return s_type_XCurrentContext;
}
diff --git a/dbaccess/source/inc/apitools.hxx b/dbaccess/source/inc/apitools.hxx
index 1a4c3a639c9c..6208b146b4c0 100644
--- a/dbaccess/source/inc/apitools.hxx
+++ b/dbaccess/source/inc/apitools.hxx
@@ -155,17 +155,8 @@ public:
#define IMPLEMENT_IMPLEMENTATION_ID( classname ) \
css::uno::Sequence< sal_Int8 > classname::getUnoTunnelImplementationId() \
{ \
- static ::cppu::OImplementationId* pId = nullptr; \
- if ( !pId ) \
- { \
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \
- if ( !pId ) \
- { \
- static ::cppu::OImplementationId aId; \
- pId = &aId; \
- } \
- } \
- return pId->getImplementationId(); \
+ static ::cppu::OImplementationId aId; \
+ return aId.getImplementationId(); \
} \
css::uno::Sequence< sal_Int8 > classname::getImplementationId() \
{ \
diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx
index b6bd50f6e67b..66fa470ca631 100644
--- a/extensions/source/bibliography/framectr.cxx
+++ b/extensions/source/bibliography/framectr.cxx
@@ -95,35 +95,25 @@ static const DispatchInfo SupportedCommandsArray[] =
{ ".uno:Bib/removeFilter" , frame::CommandGroup::DATA , true },
{ ".uno:Bib/sdbsource" , frame::CommandGroup::DATA , true },
{ ".uno:Bib/Mapping" , frame::CommandGroup::DATA , true },
- { nullptr , 0 , false }
};
typedef std::unordered_map< OUString, CacheDispatchInfo > CmdToInfoCache;
static const CmdToInfoCache& GetCommandToInfoCache()
{
- static bool bCacheInitialized = false;
- static CmdToInfoCache aCmdToInfoCache;
-
- if ( !bCacheInitialized )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( !bCacheInitialized )
+ static CmdToInfoCache aCmdToInfoCache = []() {
+ CmdToInfoCache aCache;
+ for (const auto& command : SupportedCommandsArray)
{
- sal_Int32 i( 0 );
- while ( SupportedCommandsArray[i].pCommand != nullptr )
- {
- OUString aCommand( OUString::createFromAscii( SupportedCommandsArray[i].pCommand ));
+ OUString aCommand(OUString::createFromAscii(command.pCommand));
- CacheDispatchInfo aDispatchInfo;
- aDispatchInfo.nGroupId = SupportedCommandsArray[i].nGroupId;
- aDispatchInfo.bActiveConnection = SupportedCommandsArray[i].bActiveConnection;
- aCmdToInfoCache.emplace(aCommand, aDispatchInfo);
- ++i;
- }
- bCacheInitialized = true;
+ CacheDispatchInfo aDispatchInfo;
+ aDispatchInfo.nGroupId = command.nGroupId;
+ aDispatchInfo.bActiveConnection = command.bActiveConnection;
+ aCache.emplace(aCommand, aDispatchInfo);
}
- }
+ return aCache;
+ }();
return aCmdToInfoCache;
}
diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx
index 544fb9b83c1d..224b4b77e3d9 100644
--- a/extensions/source/propctrlr/eventhandler.cxx
+++ b/extensions/source/propctrlr/eventhandler.cxx
@@ -154,56 +154,53 @@ namespace pcr
namespace
{
- #define DESCRIBE_EVENT( asciinamespace, asciilistener, asciimethod, id_postfix ) \
- s_aKnownEvents.emplace( \
+ #define DESCRIBE_EVENT( map, asciinamespace, asciilistener, asciimethod, id_postfix ) \
+ map.emplace( \
asciimethod, \
EventDescription( ++nEventId, asciinamespace, asciilistener, asciimethod, RID_STR_EVT_##id_postfix, HID_EVT_##id_postfix, UID_BRWEVT_##id_postfix ) )
bool lcl_getEventDescriptionForMethod( const OUString& _rMethodName, EventDescription& _out_rDescription )
{
- static EventMap s_aKnownEvents;
- if ( s_aKnownEvents.empty() )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( s_aKnownEvents.empty() )
- {
- static sal_Int32 nEventId = 0;
-
- DESCRIBE_EVENT( "form", "XApproveActionListener", "approveAction", APPROVEACTIONPERFORMED );
- DESCRIBE_EVENT( "awt", "XActionListener", "actionPerformed", ACTIONPERFORMED );
- DESCRIBE_EVENT( "form", "XChangeListener", "changed", CHANGED );
- DESCRIBE_EVENT( "awt", "XTextListener", "textChanged", TEXTCHANGED );
- DESCRIBE_EVENT( "awt", "XItemListener", "itemStateChanged", ITEMSTATECHANGED );
- DESCRIBE_EVENT( "awt", "XFocusListener", "focusGained", FOCUSGAINED );
- DESCRIBE_EVENT( "awt", "XFocusListener", "focusLost", FOCUSLOST );
- DESCRIBE_EVENT( "awt", "XKeyListener", "keyPressed", KEYTYPED );
- DESCRIBE_EVENT( "awt", "XKeyListener", "keyReleased", KEYUP );
- DESCRIBE_EVENT( "awt", "XMouseListener", "mouseEntered", MOUSEENTERED );
- DESCRIBE_EVENT( "awt", "XMouseMotionListener", "mouseDragged", MOUSEDRAGGED );
- DESCRIBE_EVENT( "awt", "XMouseMotionListener", "mouseMoved", MOUSEMOVED );
- DESCRIBE_EVENT( "awt", "XMouseListener", "mousePressed", MOUSEPRESSED );
- DESCRIBE_EVENT( "awt", "XMouseListener", "mouseReleased", MOUSERELEASED );
- DESCRIBE_EVENT( "awt", "XMouseListener", "mouseExited", MOUSEEXITED );
- DESCRIBE_EVENT( "form", "XResetListener", "approveReset", APPROVERESETTED );
- DESCRIBE_EVENT( "form", "XResetListener", "resetted", RESETTED );
- DESCRIBE_EVENT( "form", "XSubmitListener", "approveSubmit", SUBMITTED );
- DESCRIBE_EVENT( "form", "XUpdateListener", "approveUpdate", BEFOREUPDATE );
- DESCRIBE_EVENT( "form", "XUpdateListener", "updated", AFTERUPDATE );
- DESCRIBE_EVENT( "form", "XLoadListener", "loaded", LOADED );
- DESCRIBE_EVENT( "form", "XLoadListener", "reloading", RELOADING );
- DESCRIBE_EVENT( "form", "XLoadListener", "reloaded", RELOADED );
- DESCRIBE_EVENT( "form", "XLoadListener", "unloading", UNLOADING );
- DESCRIBE_EVENT( "form", "XLoadListener", "unloaded", UNLOADED );
- DESCRIBE_EVENT( "form", "XConfirmDeleteListener", "confirmDelete", CONFIRMDELETE );
- DESCRIBE_EVENT( "sdb", "XRowSetApproveListener", "approveRowChange", APPROVEROWCHANGE );
- DESCRIBE_EVENT( "sdbc", "XRowSetListener", "rowChanged", ROWCHANGE );
- DESCRIBE_EVENT( "sdb", "XRowSetApproveListener", "approveCursorMove", POSITIONING );
- DESCRIBE_EVENT( "sdbc", "XRowSetListener", "cursorMoved", POSITIONED );
- DESCRIBE_EVENT( "form", "XDatabaseParameterListener", "approveParameter", APPROVEPARAMETER );
- DESCRIBE_EVENT( "sdb", "XSQLErrorListener", "errorOccured", ERROROCCURRED );
- DESCRIBE_EVENT( "awt", "XAdjustmentListener", "adjustmentValueChanged", ADJUSTMENTVALUECHANGED );
- }
- }
+ static EventMap s_aKnownEvents = []() {
+ EventMap aMap;
+ sal_Int32 nEventId = 0;
+
+ DESCRIBE_EVENT(aMap, "form", "XApproveActionListener", "approveAction", APPROVEACTIONPERFORMED);
+ DESCRIBE_EVENT(aMap, "awt", "XActionListener", "actionPerformed", ACTIONPERFORMED);
+ DESCRIBE_EVENT(aMap, "form", "XChangeListener", "changed", CHANGED);
+ DESCRIBE_EVENT(aMap, "awt", "XTextListener", "textChanged", TEXTCHANGED);
+ DESCRIBE_EVENT(aMap, "awt", "XItemListener", "itemStateChanged", ITEMSTATECHANGED);
+ DESCRIBE_EVENT(aMap, "awt", "XFocusListener", "focusGained", FOCUSGAINED);
+ DESCRIBE_EVENT(aMap, "awt", "XFocusListener", "focusLost", FOCUSLOST);
+ DESCRIBE_EVENT(aMap, "awt", "XKeyListener", "keyPressed", KEYTYPED);
+ DESCRIBE_EVENT(aMap, "awt", "XKeyListener", "keyReleased", KEYUP);
+ DESCRIBE_EVENT(aMap, "awt", "XMouseListener", "mouseEntered", MOUSEENTERED);
+ DESCRIBE_EVENT(aMap, "awt", "XMouseMotionListener", "mouseDragged", MOUSEDRAGGED);
+ DESCRIBE_EVENT(aMap, "awt", "XMouseMotionListener", "mouseMoved", MOUSEMOVED);
+ DESCRIBE_EVENT(aMap, "awt", "XMouseListener", "mousePressed", MOUSEPRESSED);
+ DESCRIBE_EVENT(aMap, "awt", "XMouseListener", "mouseReleased", MOUSERELEASED);
+ DESCRIBE_EVENT(aMap, "awt", "XMouseListener", "mouseExited", MOUSEEXITED);
+ DESCRIBE_EVENT(aMap, "form", "XResetListener", "approveReset", APPROVERESETTED);
+ DESCRIBE_EVENT(aMap, "form", "XResetListener", "resetted", RESETTED);
+ DESCRIBE_EVENT(aMap, "form", "XSubmitListener", "approveSubmit", SUBMITTED);
+ DESCRIBE_EVENT(aMap, "form", "XUpdateListener", "approveUpdate", BEFOREUPDATE);
+ DESCRIBE_EVENT(aMap, "form", "XUpdateListener", "updated", AFTERUPDATE);
+ DESCRIBE_EVENT(aMap, "form", "XLoadListener", "loaded", LOADED);
+ DESCRIBE_EVENT(aMap, "form", "XLoadListener", "reloading", RELOADING);
+ DESCRIBE_EVENT(aMap, "form", "XLoadListener", "reloaded", RELOADED);
+ DESCRIBE_EVENT(aMap, "form", "XLoadListener", "unloading", UNLOADING);
+ DESCRIBE_EVENT(aMap, "form", "XLoadListener", "unloaded", UNLOADED);
+ DESCRIBE_EVENT(aMap, "form", "XConfirmDeleteListener", "confirmDelete", CONFIRMDELETE);
+ DESCRIBE_EVENT(aMap, "sdb", "XRowSetApproveListener", "approveRowChange", APPROVEROWCHANGE);
+ DESCRIBE_EVENT(aMap, "sdbc", "XRowSetListener", "rowChanged", ROWCHANGE);
+ DESCRIBE_EVENT(aMap, "sdb", "XRowSetApproveListener", "approveCursorMove", POSITIONING);
+ DESCRIBE_EVENT(aMap, "sdbc", "XRowSetListener", "cursorMoved", POSITIONED);
+ DESCRIBE_EVENT(aMap, "form", "XDatabaseParameterListener", "approveParameter", APPROVEPARAMETER);
+ DESCRIBE_EVENT(aMap, "sdb", "XSQLErrorListener", "errorOccured", ERROROCCURRED);
+ DESCRIBE_EVENT(aMap, "awt", "XAdjustmentListener", "adjustmentValueChanged", ADJUSTMENTVALUECHANGED);
+
+ return aMap;
+ }();
EventMap::const_iterator pos = s_aKnownEvents.find( _rMethodName );
if ( pos == s_aKnownEvents.end() )
diff --git a/forms/source/richtext/richtextmodel.cxx b/forms/source/richtext/richtextmodel.cxx
index ba25affe199f..7d0ff09eeed8 100644
--- a/forms/source/richtext/richtextmodel.cxx
+++ b/forms/source/richtext/richtextmodel.cxx
@@ -524,17 +524,8 @@ namespace frm
Sequence< sal_Int8 > ORichTextModel::getEditEngineTunnelId()
{
- static ::cppu::OImplementationId * pId = nullptr;
- if (! pId)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
+ static cppu::OImplementationId aId;
+ return aId.getImplementationId();
}
diff --git a/svx/source/table/tablecolumn.cxx b/svx/source/table/tablecolumn.cxx
index 183659670256..2342c6f10c87 100644
--- a/svx/source/table/tablecolumn.cxx
+++ b/svx/source/table/tablecolumn.cxx
@@ -234,47 +234,41 @@ Any SAL_CALL TableColumn::getFastPropertyValue( sal_Int32 nHandle )
rtl::Reference< FastPropertySetInfo > TableColumn::getStaticPropertySetInfo()
{
- static rtl::Reference< FastPropertySetInfo > xInfo;
- if( !xInfo.is() )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !xInfo.is() )
- {
- PropertyVector aProperties(6);
-
- aProperties[0].Name = "Width";
- aProperties[0].Handle = Property_Width;
- aProperties[0].Type = ::cppu::UnoType<sal_Int32>::get();
- aProperties[0].Attributes = 0;
-
- aProperties[1].Name = "OptimalWidth";
- aProperties[1].Handle = Property_OptimalWidth;
- aProperties[1].Type = cppu::UnoType<bool>::get();
- aProperties[1].Attributes = 0;
-
- aProperties[2].Name = "IsVisible";
- aProperties[2].Handle = Property_IsVisible;
- aProperties[2].Type = cppu::UnoType<bool>::get();
- aProperties[2].Attributes = 0;
-
- aProperties[3].Name = "IsStartOfNewPage";
- aProperties[3].Handle = Property_IsStartOfNewPage;
- aProperties[3].Type = cppu::UnoType<bool>::get();
- aProperties[3].Attributes = 0;
-
- aProperties[4].Name = "Size";
- aProperties[4].Handle = Property_Width;
- aProperties[4].Type = ::cppu::UnoType<sal_Int32>::get();
- aProperties[4].Attributes = 0;
-
- aProperties[5].Name = "OptimalSize";
- aProperties[5].Handle = Property_OptimalWidth;
- aProperties[5].Type = cppu::UnoType<bool>::get();
- aProperties[5].Attributes = 0;
-
- xInfo.set( new FastPropertySetInfo(aProperties) );
- }
- }
+ static rtl::Reference<FastPropertySetInfo> xInfo = []() {
+ PropertyVector aProperties(6);
+
+ aProperties[0].Name = "Width";
+ aProperties[0].Handle = Property_Width;
+ aProperties[0].Type = ::cppu::UnoType<sal_Int32>::get();
+ aProperties[0].Attributes = 0;
+
+ aProperties[1].Name = "OptimalWidth";
+ aProperties[1].Handle = Property_OptimalWidth;
+ aProperties[1].Type = cppu::UnoType<bool>::get();
+ aProperties[1].Attributes = 0;
+
+ aProperties[2].Name = "IsVisible";
+ aProperties[2].Handle = Property_IsVisible;
+ aProperties[2].Type = cppu::UnoType<bool>::get();
+ aProperties[2].Attributes = 0;
+
+ aProperties[3].Name = "IsStartOfNewPage";
+ aProperties[3].Handle = Property_IsStartOfNewPage;
+ aProperties[3].Type = cppu::UnoType<bool>::get();
+ aProperties[3].Attributes = 0;
+
+ aProperties[4].Name = "Size";
+ aProperties[4].Handle = Property_Width;
+ aProperties[4].Type = ::cppu::UnoType<sal_Int32>::get();
+ aProperties[4].Attributes = 0;
+
+ aProperties[5].Name = "OptimalSize";
+ aProperties[5].Handle = Property_OptimalWidth;
+ aProperties[5].Type = cppu::UnoType<bool>::get();
+ aProperties[5].Attributes = 0;
+
+ return rtl::Reference<FastPropertySetInfo>(new FastPropertySetInfo(aProperties));
+ }();
return xInfo;
}
diff --git a/svx/source/table/tablerow.cxx b/svx/source/table/tablerow.cxx
index 87cba24d12cd..d1dd1f371800 100644
--- a/svx/source/table/tablerow.cxx
+++ b/svx/source/table/tablerow.cxx
@@ -308,47 +308,41 @@ Any SAL_CALL TableRow::getFastPropertyValue( sal_Int32 nHandle )
rtl::Reference< FastPropertySetInfo > TableRow::getStaticPropertySetInfo()
{
- static rtl::Reference< FastPropertySetInfo > xInfo;
- if( !xInfo.is() )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !xInfo.is() )
- {
- PropertyVector aProperties(6);
-
- aProperties[0].Name = "Height";
- aProperties[0].Handle = Property_Height;
- aProperties[0].Type = ::cppu::UnoType<sal_Int32>::get();
- aProperties[0].Attributes = 0;
-
- aProperties[1].Name = "OptimalHeight";
- aProperties[1].Handle = Property_OptimalHeight;
- aProperties[1].Type = cppu::UnoType<bool>::get();
- aProperties[1].Attributes = 0;
-
- aProperties[2].Name = "IsVisible";
- aProperties[2].Handle = Property_IsVisible;
- aProperties[2].Type = cppu::UnoType<bool>::get();
- aProperties[2].Attributes = 0;
-
- aProperties[3].Name = "IsStartOfNewPage";
- aProperties[3].Handle = Property_IsStartOfNewPage;
- aProperties[3].Type = cppu::UnoType<bool>::get();
- aProperties[3].Attributes = 0;
-
- aProperties[4].Name = "Size";
- aProperties[4].Handle = Property_Height;
- aProperties[4].Type = ::cppu::UnoType<sal_Int32>::get();
- aProperties[4].Attributes = 0;
-
- aProperties[5].Name = "OptimalSize";
- aProperties[5].Handle = Property_OptimalHeight;
- aProperties[5].Type = cppu::UnoType<bool>::get();
- aProperties[5].Attributes = 0;
-
- xInfo.set( new FastPropertySetInfo(aProperties) );
- }
- }
+ static rtl::Reference<FastPropertySetInfo> xInfo = []() {
+ PropertyVector aProperties(6);
+
+ aProperties[0].Name = "Height";
+ aProperties[0].Handle = Property_Height;
+ aProperties[0].Type = ::cppu::UnoType<sal_Int32>::get();
+ aProperties[0].Attributes = 0;
+
+ aProperties[1].Name = "OptimalHeight";
+ aProperties[1].Handle = Property_OptimalHeight;
+ aProperties[1].Type = cppu::UnoType<bool>::get();
+ aProperties[1].Attributes = 0;
+
+ aProperties[2].Name = "IsVisible";
+ aProperties[2].Handle = Property_IsVisible;
+ aProperties[2].Type = cppu::UnoType<bool>::get();
+ aProperties[2].Attributes = 0;
+
+ aProperties[3].Name = "IsStartOfNewPage";
+ aProperties[3].Handle = Property_IsStartOfNewPage;
+ aProperties[3].Type = cppu::UnoType<bool>::get();
+ aProperties[3].Attributes = 0;
+
+ aProperties[4].Name = "Size";
+ aProperties[4].Handle = Property_Height;
+ aProperties[4].Type = ::cppu::UnoType<sal_Int32>::get();
+ aProperties[4].Attributes = 0;
+
+ aProperties[5].Name = "OptimalSize";
+ aProperties[5].Handle = Property_OptimalHeight;
+ aProperties[5].Type = cppu::UnoType<bool>::get();
+ aProperties[5].Attributes = 0;
+
+ return rtl::Reference<FastPropertySetInfo>(new FastPropertySetInfo(aProperties));
+ }();
return xInfo;
}
diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx
index 1235e6c09889..4d05caa81ff8 100644
--- a/toolkit/source/controls/controlmodelcontainerbase.cxx
+++ b/toolkit/source/controls/controlmodelcontainerbase.cxx
@@ -79,18 +79,8 @@ namespace
{
const Sequence< OUString >& lcl_getLanguageDependentProperties()
{
- static Sequence< OUString > s_aLanguageDependentProperties;
- if ( s_aLanguageDependentProperties.getLength() == 0 )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( s_aLanguageDependentProperties.getLength() == 0 )
- {
- s_aLanguageDependentProperties.realloc( 2 );
- s_aLanguageDependentProperties[0] = "HelpText";
- s_aLanguageDependentProperties[1] = "Title";
- // note: properties must be sorted
- }
- }
+ // note: properties must be sorted
+ static Sequence<OUString> s_aLanguageDependentProperties{ "HelpText", "Title" };
return s_aLanguageDependentProperties;
}
}
More information about the Libreoffice-commits
mailing list