Fix an issue with `WeakRef`s being over-released
As an optimisation, on load of a weak reference we check if the object has already been deallocated and, if so, decrement the weak reference count and zero the pointer to the weak reference structure so that the next check is faster and doesn't need to hold locks for as long. Unfortunately, the prior implementation of this instead decremented the weak reference count and then only zeroed the pointer if the reference count reached zero. This meant that loading the same __weak pointer twice after the pointed-to object had been deallocated would decrement the reference count twice.main
parent
2fb1194cec
commit
4482919e09
Loading…
Reference in New Issue