Merge pull request #5972 from leoetlino/close
WiimoteReal: Fix device handles not being closed
This commit is contained in:
commit
378416f986
|
@ -25,6 +25,7 @@
|
||||||
#include "Common/CommonFuncs.h"
|
#include "Common/CommonFuncs.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
|
#include "Common/ScopeGuard.h"
|
||||||
#include "Common/Thread.h"
|
#include "Common/Thread.h"
|
||||||
#include "Core/HW/WiimoteCommon/WiimoteConstants.h"
|
#include "Core/HW/WiimoteCommon/WiimoteConstants.h"
|
||||||
#include "Core/HW/WiimoteReal/IOWin.h"
|
#include "Core/HW/WiimoteReal/IOWin.h"
|
||||||
|
@ -366,6 +367,8 @@ static bool IsWiimote(const std::basic_string<TCHAR>& device_path, WinWriteMetho
|
||||||
if (dev_handle == INVALID_HANDLE_VALUE)
|
if (dev_handle == INVALID_HANDLE_VALUE)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Common::ScopeGuard handle_guard{[&dev_handle] { CloseHandle(dev_handle); }};
|
||||||
|
|
||||||
u8 buf[MAX_PAYLOAD];
|
u8 buf[MAX_PAYLOAD];
|
||||||
u8 const req_status_report[] = {WR_SET_REPORT | BT_OUTPUT, RT_REQUEST_STATUS, 0};
|
u8 const req_status_report[] = {WR_SET_REPORT | BT_OUTPUT, RT_REQUEST_STATUS, 0};
|
||||||
int invalid_report_count = 0;
|
int invalid_report_count = 0;
|
||||||
|
|
Loading…
Reference in New Issue