diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-04 15:28:37 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-04 14:46:01 +0100 |
commit | e128f7806961b391cfb265a1ce009b2e036622ca (patch) | |
tree | eda1097987f07ac6e2f507f898b71ddf929e0635 /xmloff | |
parent | a2058e7516a01167c2d20ed157500b38db967c64 (diff) |
replace double-checked locking patterns with thread safe local statics
Change-Id: I1bf67196e97411aeecc13ed4f91d1088a315e323
Reviewed-on: https://gerrit.libreoffice.org/62839
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/forms/handler/form_handler_factory.cxx | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/xmloff/source/forms/handler/form_handler_factory.cxx b/xmloff/source/forms/handler/form_handler_factory.cxx index 8ea62c5fc4c7..9699193af488 100644 --- a/xmloff/source/forms/handler/form_handler_factory.cxx +++ b/xmloff/source/forms/handler/form_handler_factory.cxx @@ -26,12 +26,6 @@ namespace xmloff { - namespace - { - static PPropertyHandler s_pVCLDateHandler; - static PPropertyHandler s_pVCLTimeHandler; - } - //= FormHandlerFactory PPropertyHandler FormHandlerFactory::getFormPropertyHandler( const PropertyId i_propertyId ) { @@ -43,26 +37,20 @@ namespace xmloff case PID_DATE_MAX: case PID_DEFAULT_DATE: case PID_DATE: - if ( s_pVCLDateHandler.get() == nullptr ) { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( s_pVCLDateHandler == nullptr ) - s_pVCLDateHandler = new VCLDateHandler(); + static PPropertyHandler s_pVCLDateHandler = new VCLDateHandler(); + pHandler = s_pVCLDateHandler; } - pHandler = s_pVCLDateHandler; break; case PID_TIME_MIN: case PID_TIME_MAX: case PID_DEFAULT_TIME: case PID_TIME: - if ( s_pVCLTimeHandler.get() == nullptr ) { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( s_pVCLTimeHandler == nullptr ) - s_pVCLTimeHandler = new VCLTimeHandler(); + static PPropertyHandler s_pVCLTimeHandler = new VCLTimeHandler(); + pHandler = s_pVCLTimeHandler; } - pHandler = s_pVCLTimeHandler; break; default: |