An assert was being hit because WaitableEvent's dtor was calling CloseHandle on a handle that we already closed.

BUG=8070

Review URL: http://codereview.chromium.org/40195

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11078 0039d316-1c4b-4281-b951-d872f2087c98
Esse commit está contido em:
jam@chromium.org
2009-03-06 01:21:30 +00:00
commit a37fead63f
3 arquivos alterados com 13 adições e 0 exclusões
+3
Ver Arquivo
@@ -56,6 +56,9 @@ class WaitableEvent {
// created. This objects takes ownership of the HANDLE and will close it when
// deleted.
explicit WaitableEvent(HANDLE event_handle);
// Releases ownership of the handle from this object.
HANDLE Release();
#endif
// WARNING: Destroying a WaitableEvent while threads are waiting on it is not
+6
Ver Arquivo
@@ -28,6 +28,12 @@ WaitableEvent::~WaitableEvent() {
CloseHandle(handle_);
}
HANDLE WaitableEvent::Release() {
HANDLE rv = handle_;
handle_ = INVALID_HANDLE_VALUE;
return rv;
}
void WaitableEvent::Reset() {
ResetEvent(handle_);
}
+4
Ver Arquivo
@@ -55,6 +55,10 @@ ChildProcessHost::~ChildProcessHost() {
if (handle()) {
watcher_.StopWatching();
ProcessWatcher::EnsureProcessTerminated(handle());
// Above call took ownership, so don't want WaitableEvent to assert because
// the handle isn't valid anymore.
process_event_->Release();
}
}