Rémi Bernon (@rbernon) commented about dlls/windows.devices.geolocation.geolocator/main.c:
static HRESULT WINAPI weakreferencesource_GetWeakReference(IWeakReferenceSource *iface , IWeakReference **ref) { - FIXME("iface %p, ref %p stub.\n", iface, ref); - *ref = 0; - return E_NOTIMPL; + struct geolocator *impl = impl_from_IWeakReferenceSource(iface); + + TRACE("iface %p, ref %p stub.\n", iface, ref); + *ref = &impl->IWeakReference_iface; + IWeakReference_AddRef(*ref); + return S_OK;
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. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3189#note_37260