mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-29 00:27:27 -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,25 +2976,28 @@ void RsGenExchange::performUpdateValidation()
|
||||||
delete gu.oldGrpMeta;
|
delete gu.oldGrpMeta;
|
||||||
gu.oldGrpMeta = NULL ;
|
gu.oldGrpMeta = NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDataStore->updateGroup(grps);
|
|
||||||
|
|
||||||
// notify the client
|
// notify the client
|
||||||
|
|
||||||
RsGxsGroupChange* c = new RsGxsGroupChange(RsGxsNotify::TYPE_RECEIVE, true);
|
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
|
#ifdef GEN_EXCH_DEBUG
|
||||||
std::cerr << " adding the following grp ids to notification: " << std::endl;
|
std::cerr << " adding the following grp ids to notification: " << std::endl;
|
||||||
#endif
|
#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
|
// cleanup
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue