Commit 84f258e2978418c4de35ff41461afa74fe34998a
Committed by
David Gräff
1 parent
6fb6fbe5
fix for libusb dereference crash / update appveyor links (#267)
* update appveyor link in readme.md * fix for libusb dereference crash (windows)
Showing
2 changed files
with
10 additions
and
2 deletions
openhantek/src/usb/usbdevice.cpp
| ... | ... | @@ -99,7 +99,13 @@ bool USBDevice::connectDevice(QString &errorMessage) { |
| 99 | 99 | return true; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | -USBDevice::~USBDevice() { disconnectFromDevice(); } | |
| 102 | +USBDevice::~USBDevice() { | |
| 103 | + disconnectFromDevice(); | |
| 104 | +#if defined(_WIN32) || defined(_WIN64) | |
| 105 | + if (device != nullptr) libusb_unref_device(device); | |
| 106 | + device = nullptr; | |
| 107 | +#endif | |
| 108 | +} | |
| 103 | 109 | |
| 104 | 110 | int USBDevice::claimInterface(const libusb_interface_descriptor *interfaceDescriptor, int endpointOut, int endPointIn) { |
| 105 | 111 | int errorCode = libusb_claim_interface(this->handle, interfaceDescriptor->bInterfaceNumber); |
| ... | ... | @@ -135,7 +141,9 @@ void USBDevice::disconnectFromDevice() { |
| 135 | 141 | } |
| 136 | 142 | this->handle = nullptr; |
| 137 | 143 | |
| 144 | +#if !defined(_WIN32) || !defined(_WIN64) | |
| 138 | 145 | libusb_unref_device(device); |
| 146 | +#endif | |
| 139 | 147 | |
| 140 | 148 | emit deviceDisconnected(); |
| 141 | 149 | } | ... | ... |
readme.md
| 1 | -# OpenHantek [](https://travis-ci.org/OpenHantek/openhantek) [](https://ci.appveyor.com/project/davidgraeff/openhantek/branch/master) [](https://masterminds.github.io/stability/maintenance.html) | |
| 1 | +# OpenHantek [](https://travis-ci.org/OpenHantek/openhantek) [](https://ci.appveyor.com/project/openhantek/openhantek/branch/master) [](https://masterminds.github.io/stability/maintenance.html) | |
| 2 | 2 | |
| 3 | 3 | OpenHantek is a free software for Hantek and compatible (Voltcraft/Darkwire/Protek/Acetech) USB digital signal oscilloscopes. |
| 4 | 4 | ... | ... |