diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/windowmanager/xr/intern/wm_xr.c | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/xr/intern/wm_xr_actionmap.c | 13 |
2 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/windowmanager/xr/intern/wm_xr.c b/source/blender/windowmanager/xr/intern/wm_xr.c index 3091a3a19f1..cffe14a2146 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr.c +++ b/source/blender/windowmanager/xr/intern/wm_xr.c @@ -115,7 +115,6 @@ bool wm_xr_init(wmWindowManager *wm) void wm_xr_exit(wmWindowManager *wm) { if (wm->xr.runtime != NULL) { - WM_xr_actionmaps_clear(wm->xr.runtime); wm_xr_runtime_data_free(&wm->xr.runtime); } if (wm->xr.session_settings.shading.prop) { @@ -166,6 +165,9 @@ void wm_xr_runtime_data_free(wmXrRuntimeData **runtime) /* Prevent recursive GHOST_XrContextDestroy() call by NULL'ing the context pointer before the * first call, see comment above. */ (*runtime)->context = NULL; + + WM_xr_actionmaps_clear(*runtime); + GHOST_XrContextDestroy(context); } MEM_SAFE_FREE(*runtime); diff --git a/source/blender/windowmanager/xr/intern/wm_xr_actionmap.c b/source/blender/windowmanager/xr/intern/wm_xr_actionmap.c index f9ad34b5a9b..673fdfcd602 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_actionmap.c +++ b/source/blender/windowmanager/xr/intern/wm_xr_actionmap.c @@ -178,6 +178,12 @@ XrActionMapBinding *WM_xr_actionmap_binding_find(XrActionMapItem *ami, const cha * Item in an XR action map, that maps an XR event to an operator, pose, or haptic output. * \{ */ +static void wm_xr_actionmap_item_bindings_clear(XrActionMapItem *ami) +{ + BLI_freelistN(&ami->bindings); + ami->selbinding = -1; +} + static void wm_xr_actionmap_item_properties_set(XrActionMapItem *ami) { WM_operator_properties_alloc(&(ami->op_properties_ptr), &(ami->op_properties), ami->op); @@ -345,10 +351,8 @@ bool WM_xr_actionmap_item_remove(XrActionMap *actionmap, XrActionMapItem *ami) int idx = BLI_findindex(&actionmap->items, ami); if (idx != -1) { - if (ami->op_properties_ptr) { - WM_operator_properties_free(ami->op_properties_ptr); - MEM_freeN(ami->op_properties_ptr); - } + wm_xr_actionmap_item_bindings_clear(ami); + wm_xr_actionmap_item_properties_free(ami); BLI_freelinkN(&actionmap->items, ami); if (BLI_listbase_is_empty(&actionmap->items)) { @@ -518,6 +522,7 @@ XrActionMap *WM_xr_actionmap_find(wmXrRuntimeData *runtime, const char *name) void WM_xr_actionmap_clear(XrActionMap *actionmap) { LISTBASE_FOREACH (XrActionMapItem *, ami, &actionmap->items) { + wm_xr_actionmap_item_bindings_clear(ami); wm_xr_actionmap_item_properties_free(ami); } |