From ff3bb8f3a2befbdc8b8f04056b889bb35b46871a Mon Sep 17 00:00:00 2001 From: Winged Unicorn Date: Sun, 22 Jul 2018 20:26:12 +1200 Subject: [PATCH] Reset the device pointer before libusb_exit(). --- openhantek/src/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openhantek/src/main.cpp b/openhantek/src/main.cpp index 8c2513c..f5f3b5a 100644 --- a/openhantek/src/main.cpp +++ b/openhantek/src/main.cpp @@ -205,7 +205,10 @@ int main(int argc, char *argv[]) { postProcessingThread.quit(); postProcessingThread.wait(10000); - if (context && device != nullptr) { libusb_exit(context); } + if (context && device != nullptr) { + device.reset(); // causes libusb_close(), which must be called before libusb_exit() + libusb_exit(context); + } return res; } -- libgit2 0.21.4