Skip to content

Commit f21c239

Browse files
Fix for issue #9
1 parent 0e2e3a5 commit f21c239

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

WinUSBNet/DeviceNotifyHook.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ internal void OnHandleDestroyed(object sender, EventArgs e)
6666
{
6767
// Window was destroyed, release hook.
6868
ReleaseHandle();
69-
if (_notifyHandle != null)
69+
if (_notifyHandle != IntPtr.Zero)
7070
{
7171
API.DeviceManagement.StopDeviceDeviceNotifications(_notifyHandle);
7272
_notifyHandle = IntPtr.Zero;
@@ -109,6 +109,7 @@ protected virtual void Dispose(bool disposing)
109109
if (_notifyHandle != IntPtr.Zero)
110110
{
111111
API.DeviceManagement.StopDeviceDeviceNotifications(_notifyHandle);
112+
_notifyHandle = IntPtr.Zero;
112113
}
113114
}
114115

0 commit comments

Comments
 (0)