Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: pkg/analysis_server/lib/src/services/correction/fix_internal.dart

Issue 2411063002: Issue 27539. Check that the source is not modified between constructor and correction computing. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/assist_internal.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/correction/fix_internal.dart
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index 39f96e73dcaf0b93c94927ac57fbe28b75bb913a..1a99f8fa905819498be3a5fbcdf9c29feeb1cb3f 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -139,6 +139,12 @@ class FixProcessor {
String get eol => utils.endOfLine;
Future<List<Fix>> compute() async {
+ // If the source was changed between the constructor and running
+ // this asynchronous method, it is not safe to use the unit.
+ if (context.getModificationStamp(unitSource) != fileStamp) {
+ return const <Fix>[];
+ }
+
try {
utils = new CorrectionUtils(unit);
} catch (e) {
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/assist_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698