Skip to content

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

Fix stale device cache read in input device change handler

altic-dev634ee2f0d574
diff --git a/Sources/Fluid/Services/ASRService.swift b/Sources/Fluid/Services/ASRService.swift
index 94a2cb32..7d9807db 100644
--- a/Sources/Fluid/Services/ASRService.swift
+++ b/Sources/Fluid/Services/ASRService.swift
@@ -1479,13 +1479,13 @@ final class ASRService: ObservableObject {
// Perform CoreAudio queries off the main thread — during a device topology change
// the HAL may still be settling, and synchronous queries on main can deadlock.
let preferredUID = SettingsStore.shared.preferredInputDeviceUID
- let cachedUIDs = self.cachedDeviceUIDs
DispatchQueue.global(qos: .userInitiated).async { [weak self] in
let currentDevices = AudioDevice.listInputDevices()
let systemDefault = AudioDevice.getDefaultInputDevice()
DispatchQueue.main.async { [weak self] in
guard let self else { return }
+ let cachedUIDs = self.cachedDeviceUIDs
DebugLogger.shared.debug("Current input devices: \(currentDevices.map { $0.name }.joined(separator: ", "))", source: "ASRService")