Maybe libusb_exit fails when not initialized.

This commit is contained in:
Matthew Parlane 2013-08-27 00:58:20 +12:00
parent aa7319e043
commit 8006c878f8
1 changed files with 4 additions and 2 deletions

View File

@ -111,10 +111,12 @@ CWII_IPC_HLE_Device_hid::CWII_IPC_HLE_Device_hid(u32 _DeviceID, const std::strin
CWII_IPC_HLE_Device_hid::~CWII_IPC_HLE_Device_hid() CWII_IPC_HLE_Device_hid::~CWII_IPC_HLE_Device_hid()
{ {
bool deinit_libusb = false;
if (usb_thread_running) if (usb_thread_running)
{ {
usb_thread_running = false; usb_thread_running = false;
usb_thread.join(); usb_thread.join();
deinit_libusb = true;
} }
for ( std::map<u32,libusb_device_handle*>::const_iterator iter = open_devices.begin(); iter != open_devices.end(); ++iter ) for ( std::map<u32,libusb_device_handle*>::const_iterator iter = open_devices.begin(); iter != open_devices.end(); ++iter )
@ -123,7 +125,7 @@ CWII_IPC_HLE_Device_hid::~CWII_IPC_HLE_Device_hid()
} }
open_devices.clear(); open_devices.clear();
if (deinit_libusb)
libusb_exit(NULL); libusb_exit(NULL);
} }