summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-09-11 09:21:55 +0200
committerNoel Grandin <noel@peralex.com>2015-09-14 10:00:43 +0200
commitbcb5756cb0997923ea565459440767e22ce34e7d (patch)
tree11c55ec2f41696bbe8b0204e90aa88fd9d74f3c6
parent8f2aace934eb2a91a273b6104de6383108b5c82a (diff)
list->vector
since we are copying these before iterating over them, we don't need the iterator guarantees of std::list Change-Id: I9cb2048e1527f37104c3077e69b5f3b827f08c7b
-rw-r--r--include/vcl/vclevent.hxx2
-rw-r--r--vcl/inc/svdata.hxx2
-rw-r--r--vcl/source/app/svapp.cxx7
-rw-r--r--vcl/source/app/vclevent.cxx8
4 files changed, 11 insertions, 8 deletions
diff --git a/include/vcl/vclevent.hxx b/include/vcl/vclevent.hxx
index 982958c419ae..f9e8b51564e0 100644
--- a/include/vcl/vclevent.hxx
+++ b/include/vcl/vclevent.hxx
@@ -259,7 +259,7 @@ public:
void addListener( const Link<>& rListener );
void removeListener( const Link<>& rListener );
private:
- std::list<Link<>> m_aListeners;
+ std::vector<Link<>> m_aListeners;
};
class VCL_DLLPUBLIC VclEventListeners2 : public vcl::DeletionNotifier
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index bb22ad692ed1..0d8e02c8e110 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -101,7 +101,7 @@ public:
virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ) SAL_OVERRIDE;
};
-typedef std::list<Link<VclWindowEvent&,bool> > SVAppKeyListeners;
+typedef std::vector<Link<VclWindowEvent&,bool> > SVAppKeyListeners;
struct ImplSVAppData
{
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 789da507e7ed..8f561725fc65 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -700,7 +700,10 @@ void Application::RemoveKeyListener( const Link<VclWindowEvent&,bool>& rKeyListe
{
ImplSVData* pSVData = ImplGetSVData();
if( pSVData->maAppData.mpKeyListeners )
- pSVData->maAppData.mpKeyListeners->remove( rKeyListener );
+ {
+ auto pVec = pSVData->maAppData.mpKeyListeners;
+ pVec->erase( std::remove(pVec->begin(), pVec->end(), rKeyListener ), pVec->end() );
+ }
}
bool Application::HandleKey( sal_uLong nEvent, vcl::Window *pWin, KeyEvent* pKeyEvent )
@@ -718,7 +721,7 @@ bool Application::HandleKey( sal_uLong nEvent, vcl::Window *pWin, KeyEvent* pKey
bool bProcessed = false;
// Copy the list, because this can be destroyed when calling a Link...
- std::list<Link<VclWindowEvent&,bool>> aCopy( *pSVData->maAppData.mpKeyListeners );
+ std::vector<Link<VclWindowEvent&,bool>> aCopy( *pSVData->maAppData.mpKeyListeners );
for ( Link<VclWindowEvent&,bool>& rLink : aCopy )
{
if( rLink.Call( aEvent ) )
diff --git a/vcl/source/app/vclevent.cxx b/vcl/source/app/vclevent.cxx
index 00a016d53b80..bc3ca538f285 100644
--- a/vcl/source/app/vclevent.cxx
+++ b/vcl/source/app/vclevent.cxx
@@ -48,9 +48,9 @@ void VclEventListeners::Call( VclSimpleEvent* pEvent ) const
return;
// Copy the list, because this can be destroyed when calling a Link...
- std::list<Link<>> aCopy( m_aListeners );
- std::list<Link<>>::iterator aIter( aCopy.begin() );
- std::list<Link<>>::const_iterator aEnd( aCopy.end() );
+ std::vector<Link<>> aCopy( m_aListeners );
+ std::vector<Link<>>::iterator aIter( aCopy.begin() );
+ std::vector<Link<>>::const_iterator aEnd( aCopy.end() );
if( pEvent->IsA( VclWindowEvent::StaticType() ) )
{
VclWindowEvent* pWinEvent = static_cast<VclWindowEvent*>(pEvent);
@@ -83,7 +83,7 @@ void VclEventListeners::addListener( const Link<>& rListener )
void VclEventListeners::removeListener( const Link<>& rListener )
{
- m_aListeners.remove( rListener );
+ m_aListeners.erase( std::remove(m_aListeners.begin(), m_aListeners.end(), rListener ), m_aListeners.end() );
}
VclEventListeners2::VclEventListeners2()