You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
In qusb.usb@261 a QTimer with timeout of 250ms has connected to a slot checkDevices, in which will invoke the libusb_handle_events_timeout_completed on platforms libusb support hotplug detection (like linux) or manually detect the hotplug by polling the device lists on platrforms libusb that do not support hotplug detect (like windows):
/*! Check devices present in system. This gets called by the internal timer.*/voidQUsb::checkDevices()
{
DbgPrintFuncName();
Q_D(QUsb);
QUsb::IdList list;
timeval t = { 0, 0 };
qDebug()<<QThread::currentThread();
if (d->m_has_hotplug) {
libusb_handle_events_timeout_completed(d->m_ctx, &t, Q_NULLPTR);
} else {
list = devices();
monitorDevices(list);
}
}
However, this slot function will run in the main thread where the ui will be rendered:
For this reason, if I instantance a QUsb object there will be a time-consuming process that need to be processed in main thread and the UI rendering process will be disturbed. This problem will lead to an UI stuck.
PLatform:
OS: Platforms that use polling to detect hotplug, e.g. Windows
Version: 10
To Reproduce
Steps to reproduce the behavior:
Create a Qt Widget Application with default settings.
add QtUsb Module to .pro file:
QT += core gui usb
Instance the QUsb in class MainWindow or MainDialog
Compile and Run the program,when the window showed, drag the window you will find the window does not follow the cursor smoothly:
While remove the instance of QUsb just run an empty Qt Widget Application the window could be drag smoothly:
Further more, you can try to instance more QUsb objects to amplify the jam caused by polling.
See error
Expected behavior
I'd like this process not running in the main process.
Additional context
I have checked out the sources, I found the timer has been moved to another thread while the QUsb has not moved to the other thread.
In the previous test case, if you add a QThread in MainWindow and move QUsb into it would solve the jam problem, but maybe this thread should be mantainanced by QUsb?
The text was updated successfully, but these errors were encountered:
Describe the bug
In qusb.usb@261 a QTimer with timeout of 250ms has connected to a slot
checkDevices
, in which will invoke thelibusb_handle_events_timeout_completed
on platforms libusb support hotplug detection (like linux) or manually detect the hotplug by polling the device lists on platrforms libusb that do not support hotplug detect (like windows):However, this slot function will run in the main thread where the ui will be rendered:
For this reason, if I instantance a QUsb object there will be a time-consuming process that need to be processed in main thread and the UI rendering process will be disturbed. This problem will lead to an UI stuck.
PLatform:
To Reproduce
Steps to reproduce the behavior:
MainWindow
orMainDialog
Compile and Run the program,when the window showed, drag the window you will find the window does not follow the cursor smoothly:
While remove the instance of QUsb just run an empty Qt Widget Application the window could be drag smoothly:
Further more, you can try to instance more QUsb objects to amplify the jam caused by polling.
See error
Expected behavior
I'd like this process not running in the main process.
Additional context
I have checked out the sources, I found the timer has been moved to another thread while the QUsb has not moved to the other thread.
In the previous test case, if you add a QThread in MainWindow and move QUsb into it would solve the jam problem, but maybe this thread should be mantainanced by QUsb?
The text was updated successfully, but these errors were encountered: