mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-24 08:50:10 -05:00
Fixed crash in RsDataService::retrieveNxsGrps
- accessing a deleted iterator. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6121 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
eb8d628d2a
commit
7413bdc50c
@ -654,6 +654,8 @@ int RsDataService::retrieveNxsGrps(std::map<std::string, RsNxsGrp *> &grp, bool
|
|||||||
RsStackMutex stack(mDbMutex);
|
RsStackMutex stack(mDbMutex);
|
||||||
std::map<std::string, RsNxsGrp *>::iterator mit = grp.begin();
|
std::map<std::string, RsNxsGrp *>::iterator mit = grp.begin();
|
||||||
|
|
||||||
|
std::list<std::string> toRemove;
|
||||||
|
|
||||||
for(; mit != grp.end(); mit++)
|
for(; mit != grp.end(); mit++)
|
||||||
{
|
{
|
||||||
const std::string& grpId = mit->first;
|
const std::string& grpId = mit->first;
|
||||||
@ -669,12 +671,18 @@ int RsDataService::retrieveNxsGrps(std::map<std::string, RsNxsGrp *> &grp, bool
|
|||||||
RsNxsGrp* ng = grps.front();
|
RsNxsGrp* ng = grps.front();
|
||||||
grp[ng->grpId] = ng;
|
grp[ng->grpId] = ng;
|
||||||
}else{
|
}else{
|
||||||
grp.erase(grpId);
|
toRemove.push_back(grpId);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete c;
|
delete c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::list<std::string>::iterator grpIdIt;
|
||||||
|
for (grpIdIt = toRemove.begin(); grpIdIt != toRemove.end(); ++grpIdIt)
|
||||||
|
{
|
||||||
|
grp.erase(*grpIdIt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(withMeta)
|
if(withMeta)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user