mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-12-01 06:12:52 -08:00
Verify USB listener callback handle
Do not use `handle` if `libusb_hotplug_register_callback` fails
This commit is contained in:
1 parent
fbdd97b1be
commit
34808a2caa
1 file changed
+6
-4
@@ -97,11 +97,13 @@ DeviceListenerLibUsb::registerHotplugCallback(bool arrived, bool left, int vendo
|
||||
// Avoid race conditions
|
||||
m_usbEvents.waitForFinished();
|
||||
}
|
||||
if (!m_usbEvents.isRunning()) {
|
||||
m_completed = false;
|
||||
m_usbEvents = QtConcurrent::run(handleUsbEvents, static_cast<libusb_context*>(m_ctx), &m_completed);
|
||||
if (handle > 0) {
|
||||
m_callbackHandles.insert(handle);
|
||||
if (!m_usbEvents.isRunning()) {
|
||||
m_completed = false;
|
||||
m_usbEvents = QtConcurrent::run(handleUsbEvents, static_cast<libusb_context*>(m_ctx), &m_completed);
|
||||
}
|
||||
}
|
||||
m_callbackHandles.insert(handle);
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user