mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 20:44:15 +00:00
Fix dangerous usage of vector iterator (Thanks cgreco)
This commit is contained in:
parent
493499cded
commit
7294cdafbf
@ -321,18 +321,15 @@ void TrackerList::deleteSelectedTrackers(){
|
|||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
// Iterate of trackers and remove selected ones
|
// Iterate of trackers and remove selected ones
|
||||||
|
std::vector<announce_entry> remaining_trackers;
|
||||||
std::vector<announce_entry> trackers = h.trackers();
|
std::vector<announce_entry> trackers = h.trackers();
|
||||||
std::vector<announce_entry>::iterator it = trackers.begin();
|
std::vector<announce_entry>::iterator it;
|
||||||
while(it != trackers.end()) {
|
for(it = trackers.begin(); it != trackers.end(); it++) {
|
||||||
int index = urls_to_remove.indexOf(misc::toQString((*it).url));
|
if(!urls_to_remove.contains(misc::toQString((*it).url))) {
|
||||||
if(index >= 0) {
|
remaining_trackers.push_back(*it);
|
||||||
trackers.erase(it);
|
|
||||||
urls_to_remove.removeAt(index);
|
|
||||||
} else {
|
|
||||||
it++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
h.replace_trackers(trackers);
|
h.replace_trackers(remaining_trackers);
|
||||||
h.force_reannounce();
|
h.force_reannounce();
|
||||||
// Reload Trackers
|
// Reload Trackers
|
||||||
loadTrackers();
|
loadTrackers();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user