From 9f67f42f944e342c656174ab898cabf79ac01b07 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Fri, 19 Oct 2018 21:16:08 +1100 Subject: [PATCH] [host] fix hang on capture error --- host/Service.cpp | 5 ++++- host/Service.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/host/Service.cpp b/host/Service.cpp index 00f6b2e0..bd026fca 100644 --- a/host/Service.cpp +++ b/host/Service.cpp @@ -105,6 +105,7 @@ bool Service::Initialize(ICapture * captureDevice) m_haveFrame = false; m_initialized = true; + m_running = true; return true; } @@ -138,6 +139,8 @@ bool Service::InitPointers() void Service::DeInitialize() { + m_running = false; + WaitForSingleObject(m_cursorThread, INFINITE); CloseHandle(m_cursorThread); CloseHandle(m_cursorEvent); @@ -335,7 +338,7 @@ bool Service::Process() DWORD Service::CursorThread() { - while(m_capture) + while(m_running) { if (WaitForSingleObject(m_cursorEvent, 1000) != WAIT_OBJECT_0) continue; diff --git a/host/Service.h b/host/Service.h index da0d2f16..dd9cd18a 100644 --- a/host/Service.h +++ b/host/Service.h @@ -53,6 +53,7 @@ private: ~Service(); bool m_initialized; + bool m_running; DWORD m_consoleSessionID; uint8_t * m_memory; IVSHMEM * m_ivshmem;