From 2c9f0207a7e001c13281015f047fca667e4b7e14 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Thu, 13 Mar 2014 18:11:21 +0200 Subject: [PATCH] qtd3dservice: Fix bad handle close at shutdown The control handle event is closed by the service class destructor, and the worker thread handles are closed by their destructors. So, only directly close the emulator/phone handles at shutdown. Change-Id: I03ce660100826f350f742be6e8f6ae1403c6da05 Reviewed-by: Oliver Wolff --- src/qtd3dservice/d3dservice.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/qtd3dservice/d3dservice.cpp b/src/qtd3dservice/d3dservice.cpp index b3a29c3..06c0e9e 100644 --- a/src/qtd3dservice/d3dservice.cpp +++ b/src/qtd3dservice/d3dservice.cpp @@ -392,9 +392,12 @@ bool D3DService::start() qDeleteAll(workers); - foreach (HANDLE handle, waitHandles) { - if (handle) - CloseHandle(handle); + // Close the phone and emulator handles + for (int i = 0; i <= emulatorNames.size(); ++i) { + if (GetThreadId(waitHandles[i + 1])) + delete deviceWorkers.at(i); + else + CloseHandle(waitHandles[i + 1]); } return true; -- 2.7.4