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

Unified Diff: sdk/lib/io/file_impl.dart

Issue 48113028: Don't close the _FileStream until all operations are done. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/file_impl.dart
diff --git a/sdk/lib/io/file_impl.dart b/sdk/lib/io/file_impl.dart
index ee71e567597cede20a3dddcf8fbbacf24bfd7916..dd618b3a7dbf904795b3626a661652f76163cb3a 100644
--- a/sdk/lib/io/file_impl.dart
+++ b/sdk/lib/io/file_impl.dart
@@ -90,7 +90,7 @@ class _FileStream extends Stream<List<int>> {
_readInProgress = false;
if (!_unsubscribed) {
_controller.addError(new RangeError("Bad end position: $_end"));
- _closeFile().then((_) { _controller.close(); });
+ _closeFile();
_unsubscribed = true;
}
return;
@@ -143,6 +143,7 @@ class _FileStream extends Stream<List<int>> {
} else {
openFuture = new Future.value(_File._openStdioSync(0));
}
+ _readInProgress = true;
openFuture
.then((RandomAccessFile opened) {
_openedFile = opened;
@@ -150,10 +151,13 @@ class _FileStream extends Stream<List<int>> {
return opened.setPosition(_position);
}
})
+ .whenComplete(() {
+ _readInProgress = false;
+ })
.then((_) => _readBlock())
.catchError((e) {
_controller.addError(e);
- _controller.close();
+ _closeFile();
});
}
« 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