From 96fb9ce34abb779981bddbb53267e0a1531c38d4 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Sun, 19 Jun 2022 20:36:08 +1000 Subject: [PATCH] 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) --- src/xrt/drivers/wmr/wmr_camera.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/xrt/drivers/wmr/wmr_camera.c b/src/xrt/drivers/wmr/wmr_camera.c index 1f0c10b0d..403d1cc19 100644 --- a/src/xrt/drivers/wmr/wmr_camera.c +++ b/src/xrt/drivers/wmr/wmr_camera.c @@ -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); }