From aeed0832326aa7245db189a3f336fe4df81d7142 Mon Sep 17 00:00:00 2001 From: Wei Shuai Date: Fri, 9 Feb 2018 11:38:37 +0800 Subject: tracker/wii: wiiyourself bug: no where to release write thread handle --- tracker-wii/wiiyourself/wiimote.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tracker-wii/wiiyourself/wiimote.cpp') diff --git a/tracker-wii/wiiyourself/wiimote.cpp b/tracker-wii/wiiyourself/wiimote.cpp index 79893027..956c4fc6 100644 --- a/tracker-wii/wiiyourself/wiimote.cpp +++ b/tracker-wii/wiiyourself/wiimote.cpp @@ -2114,6 +2114,14 @@ bool wiimote::WriteReport (BYTE *buff) if(bUseHIDwrite) { + /* no where to release handle, I have to do it myself */ + if (HIDwriteThread) + { + if (WaitForSingleObject(HIDwriteThread, 0) == WAIT_OBJECT_0) { + CloseHandle(HIDwriteThread); + HIDwriteThread = NULL; + } + } // HidD_SetOutputReport: +: works on MS Bluetooth stacks (WriteFile doesn't). // -: is synchronous, so make it async if(!HIDwriteThread) -- cgit v1.2.3