Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Foundation/NSCFDictionary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ internal final class _NSCFDictionary : NSMutableDictionary {
let key = unsafeBitCast(keys.advanced(by: idx).pointee!, to: NSObject.self)
keyArray.append(key)
}
keys.deinitialize(count: 1)
keys.deinitialize(count: count)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we also missing a call to actually initialize the keys? I'm not sure what it means to deinitialize anything at all without first initializing it.

It's probably true that in practice it is not necessary to deinitialize raw pointers at all.

keys.deallocate()
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Foundation/NSCFSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ internal final class _NSCFSet : NSMutableSet {
let obj = unsafeBitCast(objects.advanced(by: idx).pointee!, to: AnyObject.self)
objArray.append(obj)
}
objects.deinitialize(count: 1)
objects.deinitialize(count: count)
objects.deallocate()

return NSGeneratorEnumerator(objArray.makeIterator())
Expand Down