diff --git a/src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp b/src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp index e2f911bab..76479f854 100644 --- a/src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp +++ b/src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp @@ -25,6 +25,7 @@ #include "util/u_config_json.h" #include "os/os_time.h" +#include "xrt/xrt_device.h" #include #include @@ -118,9 +119,12 @@ cemu_device_destroy(struct xrt_device *xdev) struct cemu_system *system = dev->sys; // Remove the variable tracking. + u_device_free(&system->out_hand[dev->hand_index]->base); + + system->out_hand[dev->hand_index] = NULL; - u_device_free(&dev->base); if ((system->out_hand[0] == NULL) && (system->out_hand[1] == NULL)) { + xrt_device_destroy(&system->in_hand); u_var_remove_root(system); free(system); }