mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 920397 part 1 - base::CloseProcessHandle() checks result in debug builds and is used everywhere a process handle is closed. r=bsmedberg
This commit is contained in:
parent
437f6053a9
commit
5bc55a78af
@ -99,7 +99,11 @@ bool OpenPrivilegedProcessHandle(ProcessId pid, ProcessHandle* handle) {
|
||||
}
|
||||
|
||||
void CloseProcessHandle(ProcessHandle process) {
|
||||
CloseHandle(process);
|
||||
// closing a handle twice on Windows can be catastrophic - after the first
|
||||
// close the handle value may be reused, so the second close will kill that
|
||||
// other new handle.
|
||||
BOOL ok = CloseHandle(process);
|
||||
DCHECK(ok);
|
||||
}
|
||||
|
||||
// Helper for GetProcId()
|
||||
|
@ -12,7 +12,7 @@ namespace base {
|
||||
void Process::Close() {
|
||||
if (!process_)
|
||||
return;
|
||||
::CloseHandle(process_);
|
||||
CloseProcessHandle(process_);
|
||||
process_ = NULL;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ class TimerExpiredTask : public Task, public base::ObjectWatcher::Delegate {
|
||||
// watching. the process handle, so make sure it has stopped.
|
||||
watcher_.StopWatching();
|
||||
|
||||
CloseHandle(process_);
|
||||
base::CloseProcessHandle(process_);
|
||||
process_ = NULL;
|
||||
}
|
||||
|
||||
@ -85,13 +85,13 @@ void ProcessWatcher::EnsureProcessTerminated(base::ProcessHandle process
|
||||
|
||||
if (!force) {
|
||||
WaitForSingleObject(process, INFINITE);
|
||||
CloseHandle(process);
|
||||
base::CloseProcessHandle(process);
|
||||
return;
|
||||
}
|
||||
|
||||
// If already signaled, then we are done!
|
||||
if (WaitForSingleObject(process, 0) == WAIT_OBJECT_0) {
|
||||
CloseHandle(process);
|
||||
base::CloseProcessHandle(process);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user