fixed wrong call to std::set::erase(iterator,iterator) where the iterator comes from another set, causing inconsistencies

This commit is contained in:
csoler 2020-05-16 13:12:37 +02:00
parent 12a9dc5a79
commit 6008599f02
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C

View File

@ -415,7 +415,15 @@ bool p3GxsCircles::revokeIdsFromCircle( const std::set<RsGxsId>& identities, con
return false; return false;
} }
circleGrp.mInvitedMembers.erase(identities.begin(), identities.end()); // /!\ AVOID calling circleGrp.mInvitedMembers.erase(identities.begin(),identities.end()), because it is not the same set. Consequently
// STL code would corrupt the structure of mInvitedMembers.
std::set<RsGxsId> new_invited_members;
for(auto& gxs_id: circleGrp.mInvitedMembers)
if(identities.find(gxs_id) == identities.end())
new_invited_members.insert(gxs_id);
circleGrp.mInvitedMembers = new_invited_members;
return editCircle(circleGrp); return editCircle(circleGrp);
} }