Skip to content

Commit af01e68

Browse files
Disable toll-free bridging for CFRunLoopTimer
Foundation.Timer is not currently implemented with a compatible memory layout so attempt to bridge these classes will fail. Disabling bridging allows code using CFRunLoopTimer to work until Foundation.Timer is reimplemented. Fixes https://bugs.swift.org/browse/SR-10465
1 parent 5f48836 commit af01e68

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

Foundation/NSSwiftRuntime.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ internal func __CFInitializeSwift() {
173173
_CFRuntimeBridgeTypeToClass(CFAttributedStringGetTypeID(), unsafeBitCast(NSMutableAttributedString.self, to: UnsafeRawPointer.self))
174174
// _CFRuntimeBridgeTypeToClass(CFReadStreamGetTypeID(), unsafeBitCast(InputStream.self, UnsafeRawPointer.self))
175175
// _CFRuntimeBridgeTypeToClass(CFWriteStreamGetTypeID(), unsafeBitCast(OutputStream.self, UnsafeRawPointer.self))
176-
_CFRuntimeBridgeTypeToClass(CFRunLoopTimerGetTypeID(), unsafeBitCast(Timer.self, to: UnsafeRawPointer.self))
177-
176+
//_CFRuntimeBridgeTypeToClass(CFRunLoopTimerGetTypeID(), unsafeBitCast(Timer.self, to: UnsafeRawPointer.self))
177+
178178
__CFSwiftBridge.NSObject.isEqual = _CFSwiftIsEqual
179179
__CFSwiftBridge.NSObject.hash = _CFSwiftGetHash
180180
__CFSwiftBridge.NSObject._cfTypeID = _CFSwiftGetTypeID

Foundation/Timer.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ internal func __NSFireTimer(_ timer: CFRunLoopTimer?, info: UnsafeMutableRawPoin
1616
}
1717

1818
open class Timer : NSObject {
19-
typealias CFType = CFRunLoopTimer
20-
21-
internal var _cfObject: CFType {
19+
internal var _cfObject: CFRunLoopTimer {
2220
get {
2321
return _timer!
2422
}

0 commit comments

Comments
 (0)