Fix double-closing of handles in Windows EventHandler.
BUG= R=kasperl@google.com Review URL: https://codereview.chromium.org//315003002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36991 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -234,6 +234,8 @@ class Handle {
|
||||
virtual void DoClose();
|
||||
virtual bool IsClosed() = 0;
|
||||
|
||||
bool IsHandleClosed() const { return handle_ == INVALID_HANDLE_VALUE; }
|
||||
|
||||
void SetPortAndMask(Dart_Port port, intptr_t mask) {
|
||||
port_ = port;
|
||||
mask_ = mask;
|
||||
|
||||
Reference in New Issue
Block a user