fixed UI bug. Crash on hot plug/unplug Yubikey or similar

fix:Non-constant range: argument must be an integer literal
fix:Generic parameter 'ValueType' shadows generic parameter from outer scope with the same name; this is an error
fix:Converting non-sendable function value to '@Sendable (any FileHandleReader, any FileHandleWriter) async -> Bool' may introduce data races
This commit is contained in:
Dmitrii Taradai
2024-09-09 12:16:20 +03:00
parent 23b3297fee
commit a530a83e87
4 changed files with 14 additions and 9 deletions

View File

@@ -32,7 +32,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ aNotification: Notification) {
logger.debug("SecretAgent finished launching")
DispatchQueue.main.async {
self.socketController.handler = self.agent.handle(reader:writer:)
self.socketController.handler = { [weak self] reader, writer in
guard let self = self else { return false }
return await self.agent.handle(reader: reader, writer: writer)
}
}
NotificationCenter.default.addObserver(forName: .secretStoreReloaded, object: nil, queue: .main) { [self] _ in
try? publicKeyFileStoreController.generatePublicKeys(for: storeList.allSecrets, clear: true)