Kaydet (Commit) 8e890570 authored tarafından Julien Nabet's avatar Julien Nabet

Prefer prefix ++/-- operators for non-primitive types

+ add some const_iterator for end iterator

Change-Id: I1e01325e52b67f2f882ca1de33efa4935bbb4232
üst eed41183
...@@ -54,27 +54,28 @@ void VclEventListeners::Call( VclSimpleEvent* pEvent ) const ...@@ -54,27 +54,28 @@ void VclEventListeners::Call( VclSimpleEvent* pEvent ) const
// Copy the list, because this can be destroyed when calling a Link... // Copy the list, because this can be destroyed when calling a Link...
std::list<Link> aCopy( m_aListeners ); std::list<Link> aCopy( m_aListeners );
std::list<Link>::iterator aIter( aCopy.begin() ); std::list<Link>::iterator aIter( aCopy.begin() );
std::list<Link>::const_iterator aEnd( aCopy.end() );
if( pEvent->IsA( VclWindowEvent::StaticType() ) ) if( pEvent->IsA( VclWindowEvent::StaticType() ) )
{ {
VclWindowEvent* pWinEvent = static_cast<VclWindowEvent*>(pEvent); VclWindowEvent* pWinEvent = static_cast<VclWindowEvent*>(pEvent);
ImplDelData aDel( pWinEvent->GetWindow() ); ImplDelData aDel( pWinEvent->GetWindow() );
while ( aIter != aCopy.end() && ! aDel.IsDead() ) while ( aIter != aEnd && ! aDel.IsDead() )
{ {
Link &rLink = *aIter; Link &rLink = *aIter;
// check this hasn't been removed in some re-enterancy scenario fdo#47368 // check this hasn't been removed in some re-enterancy scenario fdo#47368
if( std::find(m_aListeners.begin(), m_aListeners.end(), rLink) != m_aListeners.end() ) if( std::find(m_aListeners.begin(), m_aListeners.end(), rLink) != m_aListeners.end() )
rLink.Call( pEvent ); rLink.Call( pEvent );
aIter++; ++aIter;
} }
} }
else else
{ {
while ( aIter != aCopy.end() ) while ( aIter != aEnd )
{ {
Link &rLink = *aIter; Link &rLink = *aIter;
if( std::find(m_aListeners.begin(), m_aListeners.end(), rLink) != m_aListeners.end() ) if( std::find(m_aListeners.begin(), m_aListeners.end(), rLink) != m_aListeners.end() )
rLink.Call( pEvent ); rLink.Call( pEvent );
aIter++; ++aIter;
} }
} }
} }
...@@ -88,14 +89,15 @@ sal_Bool VclEventListeners::Process( VclSimpleEvent* pEvent ) const ...@@ -88,14 +89,15 @@ sal_Bool VclEventListeners::Process( VclSimpleEvent* pEvent ) const
// Copy the list, because this can be destroyed when calling a Link... // Copy the list, because this can be destroyed when calling a Link...
std::list<Link> aCopy( m_aListeners ); std::list<Link> aCopy( m_aListeners );
std::list<Link>::iterator aIter( aCopy.begin() ); std::list<Link>::iterator aIter( aCopy.begin() );
while ( aIter != aCopy.end() ) std::list<Link>::const_iterator aEnd( aCopy.end() );
while ( aIter != aEnd )
{ {
if( (*aIter).Call( pEvent ) != 0 ) if( (*aIter).Call( pEvent ) != 0 )
{ {
bProcessed = sal_True; bProcessed = sal_True;
break; break;
} }
aIter++; ++aIter;
} }
return bProcessed; return bProcessed;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment