[Bf-blender-cvs] [385d9488e60] master: Fix incorrect copying of XR action paths

Peter Kim noreply at git.blender.org
Sat Feb 19 07:28:38 CET 2022


Commit: 385d9488e606023bc0edf50a45992dc85405e95b
Author: Peter Kim
Date:   Sat Feb 19 15:23:34 2022 +0900
Branches: master
https://developer.blender.org/rB385d9488e606023bc0edf50a45992dc85405e95b

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.

===================================================================

M	source/blender/windowmanager/xr/intern/wm_xr_actionmap.c

===================================================================

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;
 }



More information about the Bf-blender-cvs mailing list