From 4578ded393f8e97ae781f63c9a1cf57669409635 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sat, 15 Apr 2023 01:13:22 +0300 Subject: Simplify initialized check The previous complexity did nothing useful; it allowed to have a single unguarded boolean value check, for the cost of releasing and acquiring the mutex again. Change-Id: I426304e9ef6f27ca371544951bf3cc029887019e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150437 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- framework/source/uielement/buttontoolbarcontroller.cxx | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'framework') diff --git a/framework/source/uielement/buttontoolbarcontroller.cxx b/framework/source/uielement/buttontoolbarcontroller.cxx index 4972b6da7667..d94e5b0ff25f 100644 --- a/framework/source/uielement/buttontoolbarcontroller.cxx +++ b/framework/source/uielement/buttontoolbarcontroller.cxx @@ -90,21 +90,14 @@ void SAL_CALL ButtonToolbarController::release() noexcept void SAL_CALL ButtonToolbarController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) { - bool bInitialized( true ); - - { - SolarMutexGuard aSolarMutexGuard; - - if ( m_bDisposed ) - throw DisposedException(); + SolarMutexGuard aSolarMutexGuard; - bInitialized = m_bInitialized; - } + if ( m_bDisposed ) + throw DisposedException(); - if ( bInitialized ) + if ( m_bInitialized ) return; - SolarMutexGuard aSolarMutexGuard; m_bInitialized = true; PropertyValue aPropValue; -- cgit