From 385d9488e606023bc0edf50a45992dc85405e95b Mon Sep 17 00:00:00 2001 From: Peter Kim Date: Sat, 19 Feb 2022 15:23:34 +0900 Subject: Fix incorrect copying of XR action paths After using MEM_dupallocN() on the original item/binding, the user/component path ListBase for the new item/binding needs to be cleared and each path copied separately. --- source/blender/windowmanager/xr/intern/wm_xr_actionmap.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/xr/intern/wm_xr_actionmap.c b/source/blender/windowmanager/xr/intern/wm_xr_actionmap.c index 267fb0481a8..8a1982fa8b5 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_actionmap.c +++ b/source/blender/windowmanager/xr/intern/wm_xr_actionmap.c @@ -103,6 +103,12 @@ static XrActionMapBinding *wm_xr_actionmap_binding_copy(XrActionMapBinding *amb_ XrActionMapBinding *amb_dst = MEM_dupallocN(amb_src); amb_dst->prev = amb_dst->next = NULL; + BLI_listbase_clear(&amb_dst->component_paths); + LISTBASE_FOREACH (XrComponentPath *, path, &amb_src->component_paths) { + XrComponentPath *path_new = MEM_dupallocN(path); + BLI_addtail(&amb_dst->component_paths, path_new); + } + return amb_dst; } @@ -318,6 +324,12 @@ static XrActionMapItem *wm_xr_actionmap_item_copy(XrActionMapItem *ami_src) ami_dst->op_properties_ptr = NULL; } + BLI_listbase_clear(&ami_dst->user_paths); + LISTBASE_FOREACH (XrUserPath *, path, &ami_src->user_paths) { + XrUserPath *path_new = MEM_dupallocN(path); + BLI_addtail(&ami_dst->user_paths, path_new); + } + return ami_dst; } -- cgit v1.2.3