diff options
author | Peter Kim <pk15950@gmail.com> | 2022-02-19 09:23:34 +0300 |
---|---|---|
committer | Peter Kim <pk15950@gmail.com> | 2022-02-19 09:23:34 +0300 |
commit | 385d9488e606023bc0edf50a45992dc85405e95b (patch) | |
tree | 605f9488a9045fdae9a37c75db19f7b4f40384e1 /source/blender/windowmanager/xr/intern/wm_xr_actionmap.c | |
parent | 16d565836588de15b739ae5965d12d7794b87f3e (diff) |
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.
Diffstat (limited to 'source/blender/windowmanager/xr/intern/wm_xr_actionmap.c')
-rw-r--r-- | source/blender/windowmanager/xr/intern/wm_xr_actionmap.c | 12 |
1 files changed, 12 insertions, 0 deletions
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; } |