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

Unified Diff: runtime/bin/file_impl.dart

Issue 9072004: Make sure to close when _BaseDataInputStream reaches the end (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 12 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 | runtime/bin/stream_util.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_impl.dart
diff --git a/runtime/bin/file_impl.dart b/runtime/bin/file_impl.dart
index 915e840acff1a57798acde49e40b0a21ca0afdde..900c59b4e8f10a49c14d8dc2ce956eaf588f3764 100644
--- a/runtime/bin/file_impl.dart
+++ b/runtime/bin/file_impl.dart
@@ -11,7 +11,7 @@ class _FileInputStream extends _BaseDataInputStream implements InputStream {
}
int available() {
- return _length - _file.positionSync();
+ return _closed ? 0 : _length - _file.positionSync();
}
void pipe(OutputStream output, [bool close = true]) {
@@ -36,13 +36,15 @@ class _FileInputStream extends _BaseDataInputStream implements InputStream {
return result;
}
- void close() {
+ void _close() {
+ if (_closed) return;
_file.closeSync();
- _closeCallbackCalled = true;
+ _closed = true;
}
RandomAccessFile _file;
int _length;
+ bool _closed = false;
}
« no previous file with comments | « no previous file | runtime/bin/stream_util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698