winrt: Fix device watcher handling
When device watcher has been started it can have the enumerationComplete state in addition to started. Hence only start the watcher if none of those two states is present. This fixes an assert where starting an already started watcher failed. Change-Id: Idc3af256845f0993a26e8d186b499ef1c7e7dacc Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
@@ -204,7 +204,8 @@ public:
|
||||
DeviceWatcherStatus status;
|
||||
hr = deviceWatcher->get_Status(&status);
|
||||
Q_ASSERT_SUCCEEDED(hr);
|
||||
if (status != DeviceWatcherStatus_Started) {
|
||||
if (status != DeviceWatcherStatus_Started &&
|
||||
status != DeviceWatcherStatus_EnumerationCompleted) {
|
||||
// We can't immediately Start() if we have just called Stop()
|
||||
while (status == DeviceWatcherStatus_Stopping) {
|
||||
QThread::yieldCurrentThread();
|
||||
|
||||
Reference in New Issue
Block a user