mirror of
https://github.com/apple/swift-system
synced 2026-11-29 05:24:25 +00:00
ensure Mach.Port lives until the function returns
This commit is contained in:
1 parent
9123120c08
commit
669dcf2c25
1 file changed
+2
-1
@@ -29,7 +29,8 @@ final class MachPortTests: XCTestCase {
|
||||
}
|
||||
|
||||
func scopedReceiveRight(name:mach_port_name_t) -> mach_port_urefs_t {
|
||||
_ = Mach.Port<Mach.ReceiveRight>(name:name) // this should automatically deallocate when going out of scope
|
||||
let right = Mach.Port<Mach.ReceiveRight>(name:name) // this should automatically deallocate when going out of scope
|
||||
defer { _ = right }
|
||||
return refCountForMachPortName(name:name, kind:MACH_PORT_RIGHT_RECEIVE)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user