diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-04-02 15:12:00 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-04-02 17:22:21 +0200 |
commit | 86d298f87f00fe70d31a65b7e98f9b17fa80cb6b (patch) | |
tree | 0b7a389105ead641d092e56ff6fb1d49180f6265 /basctl | |
parent | 711ec7b6c71410b850cdf6d1411d054ca34ec5a0 (diff) |
Simplify some static variable initializations
Change-Id: I6cdd44aa66b9597ccc51fc3fd69b57485ccb3230
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113515
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/dlged/dlgedfac.cxx | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/basctl/source/dlged/dlgedfac.cxx b/basctl/source/dlged/dlgedfac.cxx index 38c8dc0d1a9c..98c0f260b0f9 100644 --- a/basctl/source/dlged/dlgedfac.cxx +++ b/basctl/source/dlged/dlgedfac.cxx @@ -46,20 +46,17 @@ DlgEdFactory::~DlgEdFactory() COVERITY_NOEXCEPT_FALSE IMPL_LINK( DlgEdFactory, MakeObject, SdrObjCreatorParams, aParams, SdrObject* ) { - static bool bNeedsInit = true; - static uno::Reference< lang::XMultiServiceFactory > xDialogSFact; - - if( bNeedsInit ) - { + static const uno::Reference<lang::XMultiServiceFactory> xDialogSFact = [] { + uno::Reference<lang::XMultiServiceFactory> xFact; uno::Reference< uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext(); uno::Reference< container::XNameContainer > xC( xContext->getServiceManager()->createInstanceWithContext( "com.sun.star.awt.UnoControlDialogModel", xContext ), uno::UNO_QUERY ); if( xC.is() ) { uno::Reference< lang::XMultiServiceFactory > xModFact( xC, uno::UNO_QUERY ); - xDialogSFact = xModFact; + xFact = xModFact; } - bNeedsInit = false; - } + return xFact; + }(); SdrObject* pNewObj = nullptr; if( (aParams.nInventor == SdrInventor::BasicDialog) && |