Marcel Taeumel uploaded a new version of FFI-Kernel to project FFI: http://source.squeak.org/FFI/FFI-Kernel-mt.169.mcz
==================== Summary ====================
Name: FFI-Kernel-mt.169 Author: mt Time: 26 May 2021, 11:37:11.537346 am UUID: cb1e1e46-ba82-ab45-b4da-779d840cb050 Ancestors: FFI-Kernel-mt.168
Fix #copy in ExternalData to always copy. Provide #assureLocal for that other scenario.
=============== Diff against FFI-Kernel-mt.168 ===============
Item was added: + ----- Method: ExternalData>>assureLocal (in category 'copying') ----- + assureLocal + + ^ handle isExternalAddress + ifTrue: [self copy] + ifFalse: [self]!
Item was changed: ----- Method: ExternalData>>ffiEqual: (in category 'comparing') ----- ffiEqual: other "WARNING!! EXPENSIVE!! We can compare bytes if the types are compatible." (self ffiIdentical: other) ifTrue: [^ true]. self flag: #todo. "mt: Which types are actually compatible? :-)" self externalType asNonPointerType = other externalType asNonPointerType ifFalse: [^ false]. self flag: #todo. "mt: Follow pointers? Detect cycles? Hmmm... :-) See #free as inspiration." + ^ self assureLocal getHandle ffiEqual: other assureLocal getHandle! - ^ self copy getHandle ffiEqual: other copy getHandle!
Item was changed: ----- Method: ExternalData>>ffiEqualityHash (in category 'comparing') ----- ffiEqualityHash "WARNING!! EXPENSIVE!!" self ffiIdentityHash + bitXor: self assureLocal getHandle hash! - bitXor: self copy getHandle hash!
Item was changed: ----- Method: ExternalData>>postCopy (in category 'copying') ----- postCopy + "Reads all bytes from external into object memory or duplicate the array within object memory. Note that this does not flatten all bytes into a single array by repeatedly calling it." - "Reads all bytes into object memory. Note that this does not flatten all bytes into a single array by repeatedly calling it. Also note that this does only work for an external address. It does not copy what's already in object memory."
| bytes | - handle isExternalAddress ifFalse: [^ self]. self sizeCheck. bytes := ByteArray new: self byteSize. 1 to: bytes size do: [:index | bytes basicAt: index put: (handle unsignedByteAt: index)]. handle := bytes. self setType: type. "Change container type from pointer to non-pointer type."!
packages@lists.squeakfoundation.org