Skip to content

Commit 9a00e67

Browse files
atrickDYL
authored andcommitted
Fix an extra retain caused by copy-paste.
1 parent 15a8716 commit 9a00e67

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Foundation/NSSwiftRuntime.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,12 @@ extension NSObject {
341341
}
342342

343343
func withUnretainedReference<T, R>(_ work: @noescape (UnsafePointer<T>) -> R) -> R {
344-
let selfPtr = Unmanaged.passRetained(self).toOpaque().assumingMemoryBound(to: T.self)
344+
let selfPtr = Unmanaged.passUnretained(self).toOpaque().assumingMemoryBound(to: T.self)
345345
return work(selfPtr)
346346
}
347347

348348
func withUnretainedReference<T, R>(_ work: @noescape (UnsafeMutablePointer<T>) -> R) -> R {
349-
let selfPtr = Unmanaged.passRetained(self).toOpaque().assumingMemoryBound(to: T.self)
349+
let selfPtr = Unmanaged.passUnretained(self).toOpaque().assumingMemoryBound(to: T.self)
350350
return work(selfPtr)
351351
}
352352
}

0 commit comments

Comments
 (0)