mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -04:00
fixed potential crash due to using deleted data (found by dimqua)
This commit is contained in:
parent
1fb1f3ebaf
commit
57f4463864
1 changed files with 16 additions and 13 deletions
|
@ -2976,26 +2976,29 @@ void RsGenExchange::performUpdateValidation()
|
|||
delete gu.oldGrpMeta;
|
||||
gu.oldGrpMeta = NULL ;
|
||||
}
|
||||
|
||||
mDataStore->updateGroup(grps);
|
||||
|
||||
// notify the client
|
||||
|
||||
RsGxsGroupChange* c = new RsGxsGroupChange(RsGxsNotify::TYPE_RECEIVE, true);
|
||||
|
||||
for(uint32_t i=0;i<mGroupUpdates.size();++i)
|
||||
if(mGroupUpdates[i].newGrp != NULL)
|
||||
{
|
||||
c->mGrpIdList.push_back(mGroupUpdates[i].newGrp->grpId) ;
|
||||
#ifdef GEN_EXCH_DEBUG
|
||||
std::cerr << " " << mGroupUpdates[i].newGrp->grpId << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
mNotifications.push_back(c);
|
||||
|
||||
// Warning: updateGroup will destroy the objects in grps. Dont use it afterwards!
|
||||
|
||||
mDataStore->updateGroup(grps);
|
||||
|
||||
#ifdef GEN_EXCH_DEBUG
|
||||
std::cerr << " adding the following grp ids to notification: " << std::endl;
|
||||
#endif
|
||||
for(uint32_t i=0;i<mGroupUpdates.size();++i)
|
||||
{
|
||||
c->mGrpIdList.push_back(mGroupUpdates[i].newGrp->grpId) ;
|
||||
#ifdef GEN_EXCH_DEBUG
|
||||
std::cerr << " " << mGroupUpdates[i].newGrp->grpId << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
mNotifications.push_back(c);
|
||||
|
||||
|
||||
// cleanup
|
||||
|
||||
mGroupUpdates.clear();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue