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. 1) On creation, both refcount are initialized to 1. 2) Non-weak interfaces will increment/decrement the public refcount. 3) When the public refcount reaches 0, the private refcount is decremented. 4) IWeakReference only increment/decrement the private refcount. 5) When the private refcount reaches 0 the object is destroyed. 6) 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
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3189#note_37403