3 Jul
2023
3 Jul
'23
9:42 a.m.
Rémi Bernon (@rbernon) commented about dlls/windows.devices.geolocation.geolocator/main.c:
+static ULONG WINAPI weak_reference_AddRef(IWeakReference *iface) +{ + struct geolocator *impl = impl_from_IWeakReference(iface); + ULONG ref = InterlockedIncrement(&impl->ref_weak); + TRACE("iface %p increasing refcount to %lu.\n", iface, ref); + return ref; +} + +static ULONG WINAPI weak_reference_Release(IWeakReference *iface) +{ + struct geolocator *impl = impl_from_IWeakReference(iface); + ULONG ref = InterlockedDecrement(&impl->ref_weak); + if (ref == 0) + { + free(impl); + }
if (!ref)
free(impl);
I think we usually prefer this rather than comparing to 0. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3189#note_37596