diff --git a/menu/Sources/menu/AX.swift b/menu/Sources/menu/AX.swift index e64ccce..627fdc3 100644 --- a/menu/Sources/menu/AX.swift +++ b/menu/Sources/menu/AX.swift @@ -144,10 +144,10 @@ func getMenuItems( var modifiers = 0 var virtualKey = 0 if let m = getAttribute(element: child, name: kAXMenuItemCmdModifiersAttribute) { - CFNumberGetValue(m as! CFNumber, CFNumberType.longType, &modifiers) + CFNumberGetValue((m as! CFNumber), CFNumberType.longType, &modifiers) } if let v = getAttribute(element: child, name: kAXMenuItemCmdVirtualKeyAttribute) { - CFNumberGetValue(v as! CFNumber, CFNumberType.longType, &virtualKey) + CFNumberGetValue((v as! CFNumber), CFNumberType.longType, &virtualKey) } var menuItem = MenuItem() diff --git a/menu/Sources/menu/MenuItem.pb.swift b/menu/Sources/menu/MenuItem.pb.swift index 07168ad..8208c8a 100644 --- a/menu/Sources/menu/MenuItem.pb.swift +++ b/menu/Sources/menu/MenuItem.pb.swift @@ -169,6 +169,18 @@ struct MenuPath { init() {} } +#if swift(>=5.5) && canImport(_Concurrency) +extension MenuItemCache: @unchecked Sendable {} +extension MenuItemList: @unchecked Sendable {} +extension MenuItem: @unchecked Sendable {} +extension AlfredResultList: @unchecked Sendable {} +extension AlfredResultItem: @unchecked Sendable {} +extension AlfredResultItemIcon: @unchecked Sendable {} +extension Settings: @unchecked Sendable {} +extension AppFilter: @unchecked Sendable {} +extension MenuPath: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + // MARK: - Code below here is support for the SwiftProtobuf runtime. extension MenuItemCache: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { @@ -348,6 +360,10 @@ extension AlfredResultItem: SwiftProtobuf.Message, SwiftProtobuf._MessageImpleme } func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 if !self.title.isEmpty { try visitor.visitSingularStringField(value: self.title, fieldNumber: 1) } @@ -366,9 +382,9 @@ extension AlfredResultItem: SwiftProtobuf.Message, SwiftProtobuf._MessageImpleme if self.valid != false { try visitor.visitSingularBoolField(value: self.valid, fieldNumber: 6) } - if let v = self._icon { + try { if let v = self._icon { try visitor.visitSingularMessageField(value: v, fieldNumber: 7) - } + } }() try unknownFields.traverse(visitor: &visitor) }