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

Unified Diff: runtime/bin/eventhandler_win.cc

Issue 315003002: Fix double-closing of handles in Windows EventHandler. (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 | « runtime/bin/eventhandler_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/eventhandler_win.cc
diff --git a/runtime/bin/eventhandler_win.cc b/runtime/bin/eventhandler_win.cc
index 3fb27c7ff5b94bdc87510d145818eeff0d7415d9..7e2eb87eb7773862a75530b0b069d6839768b871 100644
--- a/runtime/bin/eventhandler_win.cc
+++ b/runtime/bin/eventhandler_win.cc
@@ -388,7 +388,14 @@ void DirectoryWatchHandle::EnsureInitialized(
bool DirectoryWatchHandle::IsClosed() {
- return IsClosing() && pending_read_ == NULL;
+ return IsClosing() && pending_read_ == NULL && closed_;
+}
+
kasperl 2014/06/04 11:37:54 Extra newline here.
+void DirectoryWatchHandle::DoClose() {
+ if (handle_ != INVALID_HANDLE_VALUE) {
+ Handle::DoClose();
+ }
+ closed_ = true;
}
@@ -424,11 +431,11 @@ void DirectoryWatchHandle::Stop() {
if (pending_read_ != NULL) {
CancelIoEx(handle(), pending_read_->GetCleanOverlapped());
// Don't dispose of the buffer, as it will still complete (with length 0).
- pending_read_ = NULL;
}
- CloseHandle(handle());
- handle_ = (INVALID_HANDLE_VALUE);
+ // Close handle, but don't mark as closed_.
kasperl 2014/06/04 11:37:54 closed_ -> closed.
+ MarkClosing();
+ Handle::DoClose();
}
« no previous file with comments | « runtime/bin/eventhandler_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698