Skip to content

Commit b202a8d

Browse files
committed
Invalidate CF sources and observers as their wrappers deallocate.
1 parent 840aac4 commit b202a8d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Sources/Foundation/RunLoop.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,10 @@ extension RunLoop {
294294
public var isValid: Bool {
295295
CFRunLoopObserverIsValid(cfObserver)
296296
}
297+
298+
deinit {
299+
invalidate()
300+
}
297301
}
298302

299303
@available(*, deprecated, message: "For XCTest use only.")
@@ -374,5 +378,9 @@ extension RunLoop {
374378
open func signal() {
375379
CFRunLoopSourceSignal(cfSource)
376380
}
381+
382+
deinit {
383+
invalidate()
384+
}
377385
}
378386
}

0 commit comments

Comments
 (0)