Chromium Code Reviews| Index: sdk/lib/async/future_impl.dart |
| diff --git a/sdk/lib/async/future_impl.dart b/sdk/lib/async/future_impl.dart |
| index 6ed41c9bfcd72d442fb126de1819cd0a8d839240..ceae395e363b3cb27e909278880829fc6b61331c 100644 |
| --- a/sdk/lib/async/future_impl.dart |
| +++ b/sdk/lib/async/future_impl.dart |
| @@ -109,6 +109,7 @@ class _FutureImpl<T> implements Future<T> { |
| // As each future completes, put its value into the corresponding |
| // position in the list of values. |
| int i = 0; |
| + bool completed = false; |
| for (Future future in futures) { |
| int pos = i++; |
| future.then((Object value) { |
| @@ -116,9 +117,9 @@ class _FutureImpl<T> implements Future<T> { |
| if (--remaining == 0) { |
| completer.complete(values); |
|
Anders Johnsen
2013/01/10 06:40:40
This should be 'if (completed) ...;' too, if we wa
nweiz
2013/01/10 19:20:28
Currently "remaining" never hits zero if any of th
|
| } |
| - }); |
| - future.catchError((error) { |
| - completer.completeError(error.error, error.stackTrace); |
| + }).catchError((error) { |
| + if (!completed) completer.completeError(error.error, error.stackTrace); |
| + completed = true; |
| }); |
| } |