mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed potential crash due to using deleted data (found by dimqua)
This commit is contained in:
parent
1fb1f3ebaf
commit
57f4463864
@ -2976,17 +2976,12 @@ void RsGenExchange::performUpdateValidation()
|
||||
delete gu.oldGrpMeta;
|
||||
gu.oldGrpMeta = NULL ;
|
||||
}
|
||||
|
||||
mDataStore->updateGroup(grps);
|
||||
|
||||
// notify the client
|
||||
|
||||
RsGxsGroupChange* c = new RsGxsGroupChange(RsGxsNotify::TYPE_RECEIVE, true);
|
||||
|
||||
#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)
|
||||
if(mGroupUpdates[i].newGrp != NULL)
|
||||
{
|
||||
c->mGrpIdList.push_back(mGroupUpdates[i].newGrp->grpId) ;
|
||||
#ifdef GEN_EXCH_DEBUG
|
||||
@ -2996,6 +2991,14 @@ void RsGenExchange::performUpdateValidation()
|
||||
|
||||
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
|
||||
|
||||
// cleanup
|
||||
|
||||
mGroupUpdates.clear();
|
||||
|
Loading…
Reference in New Issue
Block a user