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

Unified Diff: pkg/analysis_server/lib/src/services/correction/assist_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 | « no previous file | pkg/analysis_server/lib/src/services/correction/fix_internal.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/correction/assist_internal.dart
diff --git a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
index 75d52f191d4df158d6f85fd2d3e54a5cec566e8a..989968174a3023da781e5f66ea40df12f0074ea2 100644
--- a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
@@ -87,6 +87,12 @@ class AssistProcessor {
String get eol => utils.endOfLine;
Future<List<Assist>> compute() async {
+ // If the source was changed between the constructor and running
+ // this asynchronous method, it is not safe to use the unit.
+ if (analysisContext.getModificationStamp(source) != fileStamp) {
+ return const <Assist>[];
+ }
+
try {
utils = new CorrectionUtils(unit);
} catch (e) {
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/correction/fix_internal.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698