-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
cleanupImprove cleanness of the codeImprove cleanness of the codeenhancementNew feature or requestNew feature or request
Description
The use of CastedCData is to keep the refcount of \FFI\CData objects.
However, this solution is clearly ugly and causes confusing use-after-free.
Another solution is using \WeakMap. If we use partial \FFI\CData objects as keys to their root \FFI\CData object in a \WeakMap, we can guarantee that the root object will survive while at least one reference count of the partial objects remains.
There was a bug in php-src that prevented \WeakMap from being used with FFI extension objects, but a fix has already been released, so it's time to move to \WeakMap.
Metadata
Metadata
Assignees
Labels
cleanupImprove cleanness of the codeImprove cleanness of the codeenhancementNew feature or requestNew feature or request