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

Unified Diff: sdk/lib/async/future_impl.dart

Issue 340493002: Clear future callbacks when the future is completed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/future_impl.dart
diff --git a/sdk/lib/async/future_impl.dart b/sdk/lib/async/future_impl.dart
index 5fcbe3dc1b7ffd89fbc9f507b55453fba00d9a7f..a1f09a4fc76aaa20d773a3e7910a02b4e9214a0d 100644
--- a/sdk/lib/async/future_impl.dart
+++ b/sdk/lib/async/future_impl.dart
@@ -128,10 +128,10 @@ class _Future<T> implements Future<T> {
// If we store the type of a closure in the state field (where there are
// still bits left), we can just store two closures instead of using 4
// fields of which 2 are always null.
- final _FutureOnValue _onValueCallback;
- final _FutureErrorTest _errorTestCallback;
- final Function _onErrorCallback;
- final _FutureAction _whenCompleteActionCallback;
+ _FutureOnValue _onValueCallback;
+ _FutureErrorTest _errorTestCallback;
+ Function _onErrorCallback;
+ _FutureAction _whenCompleteActionCallback;
_FutureOnValue get _onValue => _isChained ? null : _onValueCallback;
_FutureErrorTest get _errorTest => _isChained ? null : _errorTestCallback;
@@ -578,6 +578,10 @@ class _Future<T> implements Future<T> {
}
// If we changed zone, oldZone will not be null.
if (oldZone != null) Zone._leave(oldZone);
+ listener._onValueCallback = null;
+ listener._errorTestCallback = null;
+ listener._onErrorCallback = null;
+ listener._whenCompleteActionCallback = null;
if (isPropagationAborted) return;
// If the listener's value is a future we need to chain it. Note that
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698