summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2017-05-11 01:57:23 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2017-05-14 11:06:47 +0200
commitc7c445e93baf6bbe82f9ed8da02436d1f7e0b237 (patch)
treefe2d9ecac7b75d8468762751d40ab61841edfd50 /framework
parente7982510d23c4b6047f0b81bfe1c684ecb1fff8a (diff)
Remove useless m_xContext.is() check
Similar to commit 32680923221e1 ("Fix the copy-paste"). The original code was using this to get URLTransformer, but it was later switched to using m_xURLTransformer in ca00697e3dae9 ("CWS-TOOLING: integrate CWS oj18"). Change-Id: I05592915a651a9d8e0fc443f6adeb494704a99d8 Reviewed-on: https://gerrit.libreoffice.org/37588 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'framework')
-rw-r--r--framework/source/uielement/menubarmanager.cxx131
1 files changed, 60 insertions, 71 deletions
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 365f1c5b49d5..919c77db213a 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -489,68 +489,62 @@ void MenuBarManager::RemoveListener()
{
SolarMutexGuard g;
- // Check service manager reference. Remove listener can be called due
- // to a disposing call from the frame and therefore we already removed
- // our listeners and release the service manager reference!
- if ( m_xContext.is() )
+ std::vector< MenuItemHandler* >::iterator p;
+ for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); ++p )
{
- std::vector< MenuItemHandler* >::iterator p;
- for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); ++p )
+ MenuItemHandler* pItemHandler = *p;
+ if ( pItemHandler->xMenuItemDispatch.is() )
{
- MenuItemHandler* pItemHandler = *p;
- if ( pItemHandler->xMenuItemDispatch.is() )
- {
- URL aTargetURL;
- aTargetURL.Complete = pItemHandler->aMenuItemURL;
- m_xURLTransformer->parseStrict( aTargetURL );
+ URL aTargetURL;
+ aTargetURL.Complete = pItemHandler->aMenuItemURL;
+ m_xURLTransformer->parseStrict( aTargetURL );
- pItemHandler->xMenuItemDispatch->removeStatusListener(
- static_cast< XStatusListener* >( this ), aTargetURL );
- }
+ pItemHandler->xMenuItemDispatch->removeStatusListener(
+ static_cast< XStatusListener* >( this ), aTargetURL );
+ }
- pItemHandler->xMenuItemDispatch.clear();
+ pItemHandler->xMenuItemDispatch.clear();
- if ( pItemHandler->xPopupMenu.is() )
+ if ( pItemHandler->xPopupMenu.is() )
+ {
{
- {
- // Remove popup menu from menu structure
- m_pVCLMenu->SetPopupMenu( pItemHandler->nItemId, nullptr );
- }
-
- Reference< css::lang::XEventListener > xEventListener( pItemHandler->xPopupMenuController, UNO_QUERY );
- if ( xEventListener.is() )
- {
- EventObject aEventObject;
- aEventObject.Source = static_cast<OWeakObject *>(this);
- xEventListener->disposing( aEventObject );
- }
+ // Remove popup menu from menu structure
+ m_pVCLMenu->SetPopupMenu( pItemHandler->nItemId, nullptr );
+ }
- // We now provide a popup menu controller to external code.
- // Therefore the life-time must be explicitly handled via
- // dispose!!
- try
- {
- Reference< XComponent > xComponent( pItemHandler->xPopupMenuController, UNO_QUERY );
- if ( xComponent.is() )
- xComponent->dispose();
- }
- catch ( const RuntimeException& )
- {
- throw;
- }
- catch ( const Exception& )
- {
- }
+ Reference< css::lang::XEventListener > xEventListener( pItemHandler->xPopupMenuController, UNO_QUERY );
+ if ( xEventListener.is() )
+ {
+ EventObject aEventObject;
+ aEventObject.Source = static_cast<OWeakObject *>(this);
+ xEventListener->disposing( aEventObject );
+ }
- // Release references to controller and popup menu
- pItemHandler->xPopupMenuController.clear();
- pItemHandler->xPopupMenu.clear();
+ // We now provide a popup menu controller to external code.
+ // Therefore the life-time must be explicitly handled via
+ // dispose!!
+ try
+ {
+ Reference< XComponent > xComponent( pItemHandler->xPopupMenuController, UNO_QUERY );
+ if ( xComponent.is() )
+ xComponent->dispose();
+ }
+ catch ( const RuntimeException& )
+ {
+ throw;
+ }
+ catch ( const Exception& )
+ {
}
- Reference< XComponent > xComponent( pItemHandler->xSubMenuManager, UNO_QUERY );
- if ( xComponent.is() )
- xComponent->dispose();
+ // Release references to controller and popup menu
+ pItemHandler->xPopupMenuController.clear();
+ pItemHandler->xPopupMenu.clear();
}
+
+ Reference< XComponent > xComponent( pItemHandler->xSubMenuManager, UNO_QUERY );
+ if ( xComponent.is() )
+ xComponent->dispose();
}
try
@@ -591,30 +585,25 @@ void SAL_CALL MenuBarManager::disposing( const EventObject& Source )
URL aTargetURL;
aTargetURL.Complete = pMenuItemDisposing->aMenuItemURL;
- // Check reference of service manager before we use it. Reference could
- // be cleared due to RemoveListener call!
- if ( m_xContext.is() )
+ m_xURLTransformer->parseStrict( aTargetURL );
+
+ pMenuItemDisposing->xMenuItemDispatch->removeStatusListener(
+ static_cast< XStatusListener* >( this ), aTargetURL );
+ pMenuItemDisposing->xMenuItemDispatch.clear();
+ if ( pMenuItemDisposing->xPopupMenu.is() )
{
- m_xURLTransformer->parseStrict( aTargetURL );
+ Reference< css::lang::XEventListener > xEventListener( pMenuItemDisposing->xPopupMenuController, UNO_QUERY );
+ if ( xEventListener.is() )
+ xEventListener->disposing( Source );
- pMenuItemDisposing->xMenuItemDispatch->removeStatusListener(
- static_cast< XStatusListener* >( this ), aTargetURL );
- pMenuItemDisposing->xMenuItemDispatch.clear();
- if ( pMenuItemDisposing->xPopupMenu.is() )
{
- Reference< css::lang::XEventListener > xEventListener( pMenuItemDisposing->xPopupMenuController, UNO_QUERY );
- if ( xEventListener.is() )
- xEventListener->disposing( Source );
-
- {
- // Remove popup menu from menu structure as we release our reference to
- // the controller.
- m_pVCLMenu->SetPopupMenu( pMenuItemDisposing->nItemId, nullptr );
- }
-
- pMenuItemDisposing->xPopupMenuController.clear();
- pMenuItemDisposing->xPopupMenu.clear();
+ // Remove popup menu from menu structure as we release our reference to
+ // the controller.
+ m_pVCLMenu->SetPopupMenu( pMenuItemDisposing->nItemId, nullptr );
}
+
+ pMenuItemDisposing->xPopupMenuController.clear();
+ pMenuItemDisposing->xPopupMenu.clear();
}
return;
}