On Wed Jul 30 22:33:14 2025 +0000, Vibhav Pant wrote:
We need weakref support as the HDEVQUERY object is created with async close events. That allows us to not manually create a Stopped event in order to implement `Stop`. However, this also means that if the watcher gets freed without being stopped first, the HDEVQUERY gets closed in Release. As DevCloseObjectQuery asynchronously frees the query object, using weak references allows us to implement Release without first waiting for the DevQueryStateChange event before freeing the device watcher.
Lets introduce the weak reference interface in a separate change then, and let's add a test to check that the IWeakReferenceSource interface is supposed to be implemented on the device watcher.