wmr: Clean up camera debug last.

Make sure to stop the USB thread before destroying the debug sink
as cancelling the transfers is not sufficient to guarantee
there will be no final callback (or one in progress)
This commit is contained in:
Jan Schmidt 2022-06-19 20:36:08 +10:00 committed by Ryan Pavlik
parent 11525976fa
commit 96fb9ce34a

View file

@ -489,12 +489,6 @@ wmr_camera_free(struct wmr_camera *cam)
// Stop the camera.
wmr_camera_stop(cam);
// Tidy the variable tracking.
u_var_remove_root(cam);
u_sink_debug_destroy(&cam->debug_sinks[0]);
u_sink_debug_destroy(&cam->debug_sinks[1]);
if (cam->ctx != NULL) {
int i;
@ -516,6 +510,13 @@ wmr_camera_free(struct wmr_camera *cam)
libusb_exit(cam->ctx);
}
// Tidy the variable tracking.
u_var_remove_root(cam);
u_sink_debug_destroy(&cam->debug_sinks[0]);
u_sink_debug_destroy(&cam->debug_sinks[1]);
free(cam);
}