Version 2.10.4
* Cherry-pick da133e5047e0fb447af20cd142fc0cf8363487e6 to stable
* Cherry-pick ff1f611f3eb7c3c58a3a3536ee41816d31acb2bc to stable
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3113e34..16585cd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,12 @@
+## 2.10.4 - 2020-11-12
+
+This is a patch release that fixes a crash in the Dart VM (issues [#43941][],
+[flutter/flutter#43620][], and [Dart-Code/Dart-Code#2814][]).
+
+[#43941]: https://github.com/dart-lang/sdk/issues/43941
+[flutter/flutter#43620]: https://github.com/flutter/flutter/issues/43620
+[Dart-Code/Dart-Code#2814]: https://github.com/Dart-Code/Dart-Code/issues/2814
+
## 2.10.3 - 2020-10-29
This is a patch release that fixes the following issues:
diff --git a/sdk/lib/_internal/vm/bin/file_patch.dart b/sdk/lib/_internal/vm/bin/file_patch.dart
index b243920..43fb061 100644
--- a/sdk/lib/_internal/vm/bin/file_patch.dart
+++ b/sdk/lib/_internal/vm/bin/file_patch.dart
@@ -174,9 +174,17 @@
assert(watcherPath.count > 0);
watcherPath.count--;
if (watcherPath.count == 0) {
- _unwatchPath(_id!, watcherPath.pathId);
- _pathWatchedEnd();
- _idMap.remove(watcherPath.pathId);
+ var pathId = watcherPath.pathId;
+ // DirectoryWatchHandle(aka pathId) might be closed already initiated
+ // by issueReadEvent for example. When that happens, appropriate closeEvent
+ // will arrive to us and we will remove this pathId from _idMap. If that
+ // happens we should not try to close it again as pathId is no
+ // longer usable(the memory it points to might be released)
+ if (_idMap.containsKey(pathId)) {
+ _unwatchPath(_id!, pathId);
+ _pathWatchedEnd();
+ _idMap.remove(pathId);
+ }
}
_watcherPath = null;
}
diff --git a/tools/VERSION b/tools/VERSION
index baf9ffe..16def66 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -26,6 +26,6 @@
CHANNEL stable
MAJOR 2
MINOR 10
-PATCH 3
+PATCH 4
PRERELEASE 0
PRERELEASE_PATCH 0