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

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..934c7ca96cdf1cff572e2455e7e8bdcbf0e93f8d 100644
--- a/runtime/bin/eventhandler_win.cc
+++ b/runtime/bin/eventhandler_win.cc
@@ -176,17 +176,19 @@ void Handle::Close() {
if (!IsClosing()) {
// Close the socket and set the closing state. This close method can be
// called again if this socket has pending IO operations in flight.
- ASSERT(handle_ != INVALID_HANDLE_VALUE);
MarkClosing();
// Perform handle type specific closing.
DoClose();
}
+ ASSERT(IsHandleClosed());
}
void Handle::DoClose() {
- CloseHandle(handle_);
- handle_ = INVALID_HANDLE_VALUE;
+ if (!IsHandleClosed()) {
+ CloseHandle(handle_);
+ handle_ = INVALID_HANDLE_VALUE;
+ }
}
@@ -424,11 +426,9 @@ 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);
+ 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