10 May
2025
10 May
'25
11 a.m.
Jinoh Kang (@iamahuman) commented about dlls/windows.devices.enumeration/main.c:
+ LONG count = weak->strong_count; + + while (count) + { + if (InterlockedCompareExchange( &weak->strong_count, count + 1, count) == count) + return weak->watcher; + + count = weak->strong_count; + } + return NULL; +} + +static void device_watcher_weak_decref( struct device_watcher_weak *weak ) +{ + if (!InterlockedDecrement( &weak->weak_count )) + free( weak ); Is it possible that `impl->weakref` is still holding a pointer to `weak`?
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/7997#note_102905