Skip to content

Commit

Permalink
address @tormodvolden comments, correct error handling within windows…
Browse files Browse the repository at this point in the history
…_stop_event_monitor. TO BE SQUASHED WITH PREVIOUS COMMIT
  • Loading branch information
sonatique committed Feb 13, 2024
1 parent 8ef20c7 commit 98e198c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions libusb/os/windows_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,22 @@ int windows_stop_event_monitor(void)
if (!SUCCEEDED(SendMessage(windows_event_hwnd, WM_CLOSE, 0, 0)))
{
log_error("SendMessage");
return LIBUSB_ERROR_OTHER;
}

int ret = LIBUSB_SUCCESS;

if (WaitForSingleObject(windows_event_thread_handle, INFINITE) != WAIT_OBJECT_0)
{
log_error("WaitForSingleObject");
ret = LIBUSB_ERROR_OTHER;
return LIBUSB_ERROR_OTHER;
}

if (!CloseHandle(windows_event_thread_handle))
{
log_error("CloseHandle");
ret = LIBUSB_ERROR_OTHER;
return LIBUSB_ERROR_OTHER;
}

return ret;
return LIBUSB_SUCCESS;
}

/* We leverage the backend's get_device_list method to discover new/gone devices.
Expand Down
2 changes: 1 addition & 1 deletion libusb/os/windows_winusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1899,7 +1899,7 @@ static int winusb_get_device_list(struct libusb_context *ctx)
unref_list[unref_cur++] = dev;
}

dont_track_unref:
dont_track_unref:
// Setup device
switch (pass_type) {
case HUB_PASS:
Expand Down

0 comments on commit 98e198c

Please sign in to comment.