diff --git a/qt/ManualDevicesSettingsPage/ManualDevicesSettingsPage.cpp b/qt/ManualDevicesSettingsPage/ManualDevicesSettingsPage.cpp index 2237fdbcc..9f10768c2 100644 --- a/qt/ManualDevicesSettingsPage/ManualDevicesSettingsPage.cpp +++ b/qt/ManualDevicesSettingsPage/ManualDevicesSettingsPage.cpp @@ -8,6 +8,7 @@ | SPDX-License-Identifier: GPL-2.0-or-later | \*---------------------------------------------------------*/ +#include #include "ManualDevicesSettingsPage.h" #include "ui_ManualDevicesSettingsPage.h" @@ -337,9 +338,11 @@ void ManualDevicesSettingsPage::on_ActionSaveAndRescan_triggered() { saveSettings(); - /*---------------------------------------------------------*\ - | Trigger rescan | - \*---------------------------------------------------------*/ - ResourceManager::get()->RescanDevices(); + /*-----------------------------------------------------*\ + | Run RescanDevices in an asynchronous thread to avoid | + | locking the UI thread | + \*-----------------------------------------------------*/ + std::thread rescan_thread([](){ResourceManager::get()->RescanDevices();}); + rescan_thread.detach(); } diff --git a/qt/OpenRGBDialog/OpenRGBDialog.cpp b/qt/OpenRGBDialog/OpenRGBDialog.cpp index 0d39959c2..bc20e9b5e 100644 --- a/qt/OpenRGBDialog/OpenRGBDialog.cpp +++ b/qt/OpenRGBDialog/OpenRGBDialog.cpp @@ -7,6 +7,7 @@ | SPDX-License-Identifier: GPL-2.0-or-later | \*---------------------------------------------------------*/ +#include #include "AutoStart.h" #include "OpenRGBDialog.h" #include "JsonUtils.h" @@ -2018,9 +2019,11 @@ void OpenRGBDialog::SaveProfileAs() void OpenRGBDialog::on_ButtonRescan_clicked() { /*-----------------------------------------------------*\ - | Rescan devices in ResourceManager | + | Run RescanDevices in an asynchronous thread to avoid | + | locking the UI thread | \*-----------------------------------------------------*/ - ResourceManager::get()->RescanDevices(); + std::thread rescan_thread([](){ResourceManager::get()->RescanDevices();}); + rescan_thread.detach(); } void OpenRGBDialog::on_ActionSaveProfile_triggered()