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

Unified Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 807993002: Ensure that AnalysisContext futures are completed when context disposed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Handle case of computeAsync called after dispose Created 6 years 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/test/analysis_server_test.dart ('k') | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/engine.dart
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index d62d3a7362b0a8785794ea3c9d1ce3a2eaaff5a4..038ace0d0ed675dfbf964be8b50839d6fbbb5a24 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -1781,6 +1781,12 @@ class AnalysisContextImpl implements InternalAnalysisContext {
@override
void dispose() {
_disposed = true;
+ for (List<PendingFuture> pendingFutures in _pendingFutureSources.values) {
+ for (PendingFuture pendingFuture in pendingFutures) {
+ pendingFuture.forciblyComplete();
+ }
+ }
+ _pendingFutureSources.clear();
}
@override
@@ -14354,6 +14360,11 @@ class _AnalysisFutureHelper<T> {
*/
CancelableFuture<T> computeAsync(Source source, T
computeValue(SourceEntry sourceEntry)) {
+ if (_context.isDisposed) {
+ // No further analysis is expected, so return a future that completes
+ // immediately with AnalysisNotScheduledError.
+ return new CancelableFuture.error(new AnalysisNotScheduledError());
+ }
SourceEntry sourceEntry = _context.getReadableSourceEntryOrNull(source);
if (sourceEntry == null) {
return new CancelableFuture.error(new AnalysisNotScheduledError());
« no previous file with comments | « pkg/analysis_server/test/analysis_server_test.dart ('k') | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698