fix(mac): prevent Option release deadlock and HUD layout storm
The hold-to-talk release path called AsyncStream.Continuation.finish() while holding MacAudioRecorder's NSLock; onTermination re-entered the same lock on the main thread and froze the app. Finish snapshot sinks outside the lock and guard the audio tap once stop() begins. The dictation HUD no longer reassigns its hosting view and forces a synchronous relayout on every view-model tick; it uses a fixed panel size and SwiftUI @ObservedObject refresh instead. Adds OSGKeyboardMacTests with a regression test that fails under the old lock re-entry pattern.
This commit is contained in:
+31
@@ -390,6 +390,33 @@ targets:
|
||||
PRODUCT_BUNDLE_IDENTIFIER: com.osgkeyboard.ios.ext.tests
|
||||
TARGETED_DEVICE_FAMILY: "1,2"
|
||||
|
||||
# =========================================================
|
||||
# macOS 单元测试
|
||||
# =========================================================
|
||||
# Hosted in the Mac app so `@testable import OSGKeyboard` reaches the
|
||||
# macOS-only types (MacAudioRecorder, overlay sizing) that cannot compile
|
||||
# against the iOS targets.
|
||||
OSGKeyboardMacTests:
|
||||
type: bundle.unit-test
|
||||
platform: macOS
|
||||
deploymentTarget: "15.0"
|
||||
sources:
|
||||
- path: OSGKeyboardMacTests
|
||||
info:
|
||||
path: OSGKeyboardMacTests/Info.plist
|
||||
dependencies:
|
||||
- target: OSGKeyboardMac
|
||||
settings:
|
||||
base:
|
||||
PRODUCT_BUNDLE_IDENTIFIER: com.osgkeyboard.mac.tests
|
||||
MACOSX_DEPLOYMENT_TARGET: "15.0"
|
||||
CODE_SIGN_STYLE: Automatic
|
||||
DEVELOPMENT_TEAM: X329MZU23S
|
||||
# The host target is named OSGKeyboardMac but ships as OSGKeyboard.app,
|
||||
# so the path XcodeGen infers from the target name does not exist.
|
||||
TEST_HOST: "$(BUILT_PRODUCTS_DIR)/OSGKeyboard.app/Contents/MacOS/OSGKeyboard"
|
||||
BUNDLE_LOADER: "$(TEST_HOST)"
|
||||
|
||||
# =========================================================
|
||||
# macOS 菜单栏 App (Phase 1 · 云端 MVP)
|
||||
# =========================================================
|
||||
@@ -523,5 +550,9 @@ schemes:
|
||||
OSGKeyboardMac: all
|
||||
run:
|
||||
config: Debug
|
||||
test:
|
||||
config: Debug
|
||||
targets:
|
||||
- OSGKeyboardMacTests
|
||||
archive:
|
||||
config: Release
|
||||
|
||||
Reference in New Issue
Block a user