Eliminiate concurrent map key set modification (#18284)

Iterates over a copy of the dirty entries list rather than the original,
in order to avoid the potential for a concurrent modification exception
when fileUris are removed/added later in the loop.

This occurs when non-asset URIs (Dart sources) are listed in the dirty
set when --preview-dart-2 is enabled (the default).
This commit is contained in:
Chris Bracken
2018-06-07 16:45:09 -07:00
committed by GitHub
parent 3c25817bc7
commit 0628a1fb24

View File

@@ -485,7 +485,7 @@ class DevFS {
// that it is initiated by user key press).
final List<String> invalidatedFiles = <String>[];
final Set<Uri> filesUris = new Set<Uri>();
for (Uri uri in dirtyEntries.keys) {
for (Uri uri in dirtyEntries.keys.toList()) {
if (!uri.path.startsWith(assetBuildDirPrefix)) {
final DevFSContent content = dirtyEntries[uri];
if (content is DevFSFileContent) {