From 7bee2d7473635374dead6d31a431b44f7fbbae9c Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 19 Nov 2025 13:10:13 +0000 Subject: [PATCH] [GUI] Ensure devices list is filled in UI thread. --- .../ViewModels/Windows/DeviceListViewModel.cs | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Aaru.Gui/ViewModels/Windows/DeviceListViewModel.cs b/Aaru.Gui/ViewModels/Windows/DeviceListViewModel.cs index d46095b72..47d6e7469 100644 --- a/Aaru.Gui/ViewModels/Windows/DeviceListViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/DeviceListViewModel.cs @@ -146,18 +146,21 @@ public partial class DeviceListViewModel : ViewModelBase Devices = []; - foreach(DeviceInfo device in devices) + Dispatcher.UIThread.Invoke(() => { - Devices.Add(new DeviceModel + foreach(DeviceInfo device in devices) { - Bus = device.Bus, - Model = device.Model, - Path = device.Path, - Serial = device.Serial, - Supported = device.Supported, - Vendor = device.Vendor - }); - } + Devices.Add(new DeviceModel + { + Bus = device.Bus, + Model = device.Model, + Path = device.Path, + Serial = device.Serial, + Supported = device.Supported, + Vendor = device.Vendor + }); + } + }); } catch(SocketException ex) {