History

Don't use invalidated iterators

Atlante45 committed 10 years ago

Commit dfc3e5d1 parent 6a124251 file · +6 −3Browse files

Showing the changes to libraries/networking/src/ResourceCache.cpp (1 of 1 file). Show all

Unified · Split

libraries/networking/src/ResourceCache.cpp+6−3
@@ -64,9 +64,12 @@ void ResourceCache::clearATPAssets() { · 63 unmodified lines
6464 }
6565 {
6666 QWriteLocker locker(&_resourcesToBeGottenLock);
67− for (auto& url : _resourcesToBeGotten) {
68− if (url.scheme() == URL_SCHEME_ATP) {
69− _resourcesToBeGotten.removeAll(url);
67+ auto it = _resourcesToBeGotten.begin();
68+ while (it != _resourcesToBeGotten.end()) {
69+ if (it->scheme() == URL_SCHEME_ATP) {
70+ it = _resourcesToBeGotten.erase(it);
71+ } else {
72+ ++it;
7073 }
7174 }
7275 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t