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`?