Filter DataItems with suitable way.
We should carefully modify unordered_set when traversing it. Update the iterator with the return value of erase function. Change-Id: I777f42b077502f617a513128db9a4f3b7c9a322c CRs-Fixed: 2288358
This commit is contained in:
parent
329de0d44f
commit
de454e21f6
1 changed files with 6 additions and 3 deletions
|
@ -328,9 +328,12 @@ void SystemStatusOsObserver::notify(const list<IDataItemCore*>& dlist)
|
||||||
for (auto client : clientSet) {
|
for (auto client : clientSet) {
|
||||||
unordered_set<DataItemId> dataItemIdsForThisClient(
|
unordered_set<DataItemId> dataItemIdsForThisClient(
|
||||||
mParent->mClientToDataItems.getValSet(client));
|
mParent->mClientToDataItems.getValSet(client));
|
||||||
for (auto id : dataItemIdsForThisClient) {
|
for (auto itr = dataItemIdsForThisClient.begin();
|
||||||
if (dataItemIdsToBeSent.find(id) == dataItemIdsToBeSent.end()) {
|
itr != dataItemIdsForThisClient.end(); ) {
|
||||||
dataItemIdsForThisClient.erase(id);
|
if (dataItemIdsToBeSent.find(*itr) == dataItemIdsToBeSent.end()) {
|
||||||
|
itr = dataItemIdsForThisClient.erase(itr);
|
||||||
|
} else {
|
||||||
|
itr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue