uid_t uid, const std::string& locale,
const std::unordered_set<pid_t>& pids) {
std::vector<std::string> pkgids;
- for (auto it = pending_pkg_.begin(); it != pending_pkg_.end();) {
- pid_t pid = it->second;
- if (pids.find(pid) == pids.end()) {
- it++;
+ for (const auto& [pkgid, pid] : pending_pkg_) {
+ if (pids.find(pid) == pids.end())
continue;
- }
- pkgids.emplace_back(it->first);
+ EraseWriterPID(pid);
+ pkgids.emplace_back(pkgid);
}
UpdatePendingPackageInfo(db, uid, locale, pkgids);