mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-13 20:48:02 +01:00
iterator is invalid after erase() call, so advance first. Fixes problem valgrind found.
This commit is contained in:
parent
a8cc920dcf
commit
8b936ea0ea
1 changed files with 4 additions and 2 deletions
|
@ -134,12 +134,14 @@ UDPAckTrack::threadProc()
|
||||||
MutexLock ml( &m_mutex );
|
MutexLock ml( &m_mutex );
|
||||||
time_t now = time( NULL );
|
time_t now = time( NULL );
|
||||||
map<uint32_t, AckRecord>::iterator iter;
|
map<uint32_t, AckRecord>::iterator iter;
|
||||||
for ( iter = m_pendings.begin(); iter != m_pendings.end(); ++iter ) {
|
for ( iter = m_pendings.begin(); m_pendings.end() != iter; ) {
|
||||||
time_t took = now - iter->second.m_createTime;
|
time_t took = now - iter->second.m_createTime;
|
||||||
if ( ACK_LIMIT < took ) {
|
if ( ACK_LIMIT < took ) {
|
||||||
older.push_back( iter->first );
|
older.push_back( iter->first );
|
||||||
callProc( iter->first, false, &(iter->second) );
|
callProc( iter->first, false, &(iter->second) );
|
||||||
m_pendings.erase( iter );
|
m_pendings.erase( iter++ );
|
||||||
|
} else {
|
||||||
|
++iter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue