diff options
Diffstat (limited to 'sandbox/src/broker_services.cc')
-rw-r--r-- | sandbox/src/broker_services.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sandbox/src/broker_services.cc b/sandbox/src/broker_services.cc index 5e4a2b0..ad9070f 100644 --- a/sandbox/src/broker_services.cc +++ b/sandbox/src/broker_services.cc @@ -90,7 +90,7 @@ ResultCode BrokerServicesBase::Init() { no_targets_ = ::CreateEventW(NULL, TRUE, FALSE, NULL); job_thread_ = ::CreateThread(NULL, 0, // Default security and stack. - TargetEventsThread, this, NULL, NULL); + TargetEventsThread, this, NULL, NULL); if (NULL == job_thread_) return SBOX_ERROR_GENERIC; @@ -103,6 +103,9 @@ ResultCode BrokerServicesBase::Init() { // DLL_PROCESS_DETACH in other words, holding the loader lock, so we cannot // wait for threads here. BrokerServicesBase::~BrokerServicesBase() { + // If there is no port Init() was never called successfully. + if (!job_port_) + return; // Closing the port causes, that no more Job notifications are delivered to // the worker thread and also causes the thread to exit. This is what we // want to do since we are going to close all outstanding Jobs and notifying |