diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-04-07 11:48:47 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-04-07 17:53:04 +0200 |
commit | 5a824268dfdd48c00f656b767b48cd12ccbdaabb (patch) | |
tree | a25f4afd3ca49cff41fc44559aedea70c82e6c7e /framework/source/dispatch/interceptionhelper.cxx | |
parent | a6186a678cd9f67359da885606b3c3983f6bdc74 (diff) |
Don't use resettable/clearable guard where plain guard is enough
Also use scope where possible. This allows to limit guard scope at
language level; visualises the scope clearly; and helps avoiding
errors like fixed in commit 61e4437c857854b331fa01da6f39b2b3b58a800b.
Change-Id: Ifeca96e2df8e8a0897770d9546b2536806275f41
Reviewed-on: https://gerrit.libreoffice.org/70376
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'framework/source/dispatch/interceptionhelper.cxx')
-rw-r--r-- | framework/source/dispatch/interceptionhelper.cxx | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/framework/source/dispatch/interceptionhelper.cxx b/framework/source/dispatch/interceptionhelper.cxx index 9a98285ec720..bca143bc92a3 100644 --- a/framework/source/dispatch/interceptionhelper.cxx +++ b/framework/source/dispatch/interceptionhelper.cxx @@ -40,40 +40,40 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL InterceptionHelper::queryD const OUString& sTargetFrameName, sal_Int32 nSearchFlags ) { + css::uno::Reference<css::frame::XDispatchProvider> xInterceptor; // SAFE { - SolarMutexClearableGuard aReadLock; + { + SolarMutexGuard aReadLock; - // a) first search an interceptor, which match to this URL by its URL pattern registration - // Note: if it return NULL - it does not mean an empty interceptor list automatically! - css::uno::Reference< css::frame::XDispatchProvider > xInterceptor; - InterceptorList::const_iterator pIt = m_lInterceptionRegs.findByPattern(aURL.Complete); - if (pIt != m_lInterceptionRegs.end()) - xInterceptor = pIt->xInterceptor; + // a) first search an interceptor, which match to this URL by its URL pattern registration + // Note: if it return NULL - it does not mean an empty interceptor list automatically! + InterceptorList::const_iterator pIt = m_lInterceptionRegs.findByPattern(aURL.Complete); + if (pIt != m_lInterceptionRegs.end()) + xInterceptor = pIt->xInterceptor; - // b) No match by registration - but a valid interceptor list. - // Find first interceptor w/o pattern, so we need to query it - if (!xInterceptor.is()) - { - for (auto const& lInterceptionReg : m_lInterceptionRegs) + // b) No match by registration - but a valid interceptor list. + // Find first interceptor w/o pattern, so we need to query it + if (!xInterceptor.is()) { - if (!lInterceptionReg.lURLPattern.getLength()) + for (auto const& lInterceptionReg : m_lInterceptionRegs) { - // no pattern -> need to ask this guy! - xInterceptor = lInterceptionReg.xInterceptor; - break; + if (!lInterceptionReg.lURLPattern.getLength()) + { + // no pattern -> need to ask this guy! + xInterceptor = lInterceptionReg.xInterceptor; + break; + } } + // if we didn't find any non-pattern interceptor, there's no-one + // registered for this command url (we already searched for matching + // patterns above) } - // if we didn't find any non-pattern interceptor, there's no-one - // registered for this command url (we already searched for matching - // patterns above) + // c) No registered interceptor => use our direct slave. + // This helper exist by design and must be valid everytimes ... + // But to be more feature proof - we should check that .-) + if (!xInterceptor.is() && m_xSlave.is()) + xInterceptor = m_xSlave; } - // c) No registered interceptor => use our direct slave. - // This helper exist by design and must be valid everytimes ... - // But to be more feature proof - we should check that .-) - if (!xInterceptor.is() && m_xSlave.is()) - xInterceptor = m_xSlave; - - aReadLock.clear(); // } SAFE css::uno::Reference< css::frame::XDispatch > xReturn; |