On Thu Jun 29 07:55:03 2023 +0000, Rémi Bernon wrote:
Correctly implementing IWeakReference will require to add a secondary "weak" (aka private) refcount to the object.
- On creation, both refcount are initialized to 1.
- Non-weak interfaces will increment/decrement the public refcount.
- When the public refcount reaches 0, the private refcount is decremented.
- IWeakReference only increment/decrement the private refcount.
- When the private refcount reaches 0 the object is destroyed.
- IWeakReference_Resolve checks whether the public refcount is 0.
- if it is then the object should be considered as pending destruction
and Resolve should return S_OK but set the pointer to NULL (according to MSDN, to be tested)
- if the public refcount is not 0, then Resolve returns an interface,
incrementing the public refcount once more.
Thanks, fixed in next version