diff options
author | Noel Grandin <noel@peralex.com> | 2015-09-10 16:44:12 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-09-11 08:48:55 +0200 |
commit | 71a83295d8c719f4fd4fa05f367c3c85323e22e9 (patch) | |
tree | 1ff99c92e49ad61e7b478daad338fd6109324222 /vcl/source/window/menu.cxx | |
parent | c80fb09256f02379b78f7bb219e94dfbf5277872 (diff) |
convert Link<> to typed
and remove unused maChildEventListeners
Change-Id: I845a9af608c3429cf9ccb0e8041f24f423839513
Diffstat (limited to 'vcl/source/window/menu.cxx')
-rw-r--r-- | vcl/source/window/menu.cxx | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index c2e415a4ede2..98d9740bedab 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -340,31 +340,29 @@ void Menu::ImplCallEventListeners( sal_uLong nEvent, sal_uInt16 nPos ) } if ( !aDelData.isDeleted() ) - maEventListeners.Call( &aEvent ); - - if( !aDelData.isDeleted() ) { - Menu* pMenu = this; - while ( pMenu ) + // Copy the list, because this can be destroyed when calling a Link... + std::list<Link<VclMenuEvent&,void>> aCopy( maEventListeners ); + std::list<Link<VclMenuEvent&,void>>::iterator aIter( aCopy.begin() ); + std::list<Link<VclMenuEvent&,void>>::const_iterator aEnd( aCopy.end() ); + while ( aIter != aEnd ) { - maChildEventListeners.Call( &aEvent ); - - if( aDelData.isDeleted() ) - break; - - pMenu = ( pMenu->pStartedFrom != pMenu ) ? pMenu->pStartedFrom : NULL; + Link<VclMenuEvent&,void> &rLink = *aIter; + if( std::find(maEventListeners.begin(), maEventListeners.end(), rLink) != maEventListeners.end() ) + rLink.Call( aEvent ); + ++aIter; } } } -void Menu::AddEventListener( const Link<>& rEventListener ) +void Menu::AddEventListener( const Link<VclMenuEvent&,void>& rEventListener ) { - maEventListeners.addListener( rEventListener ); + maEventListeners.push_back( rEventListener ); } -void Menu::RemoveEventListener( const Link<>& rEventListener ) +void Menu::RemoveEventListener( const Link<VclMenuEvent&,void>& rEventListener ) { - maEventListeners.removeListener( rEventListener ); + maEventListeners.remove( rEventListener ); } MenuItemData* Menu::NbcInsertItem(sal_uInt16 nId, MenuItemBits nBits, |