summaryrefslogtreecommitdiffstats
path: root/sandbox/src/broker_services.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/src/broker_services.cc')
-rw-r--r--sandbox/src/broker_services.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sandbox/src/broker_services.cc b/sandbox/src/broker_services.cc
index 557c82d..2c53a42 100644
--- a/sandbox/src/broker_services.cc
+++ b/sandbox/src/broker_services.cc
@@ -119,8 +119,11 @@ void BrokerServicesBase::FreeResources(JobTracker* tracker) {
if (NULL != tracker->policy) {
BOOL res = ::TerminateJobObject(tracker->job, SBOX_ALL_OK);
DCHECK(res);
+ // Closing the job causes the target process to be destroyed so this
+ // needs to happen before calling OnJobEmpty().
res = ::CloseHandle(tracker->job);
DCHECK(res);
+ // In OnJobEmpty() we don't actually use the job handle directly.
tracker->policy->OnJobEmpty(tracker->job);
tracker->policy->Release();
tracker->policy = NULL;