mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-09-22 13:54:41 -04:00
Verify USB listener callback handle
Do not use `handle` if `libusb_hotplug_register_callback` fails
This commit is contained in:
parent
29feb5da79
commit
59bd71ddca
1 changed files with 6 additions and 4 deletions
|
@ -97,11 +97,13 @@ DeviceListenerLibUsb::registerHotplugCallback(bool arrived, bool left, int vendo
|
||||||
// Avoid race conditions
|
// Avoid race conditions
|
||||||
m_usbEvents.waitForFinished();
|
m_usbEvents.waitForFinished();
|
||||||
}
|
}
|
||||||
|
if (handle > 0) {
|
||||||
|
m_callbackHandles.insert(handle);
|
||||||
if (!m_usbEvents.isRunning()) {
|
if (!m_usbEvents.isRunning()) {
|
||||||
m_completed = false;
|
m_completed = false;
|
||||||
m_usbEvents = QtConcurrent::run(handleUsbEvents, static_cast<libusb_context*>(m_ctx), &m_completed);
|
m_usbEvents = QtConcurrent::run(handleUsbEvents, static_cast<libusb_context*>(m_ctx), &m_completed);
|
||||||
}
|
}
|
||||||
m_callbackHandles.insert(handle);
|
}
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue