Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2019-04-14 21:53:03 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2019-04-14 21:55:30 +0300
commit3731729b96fa2145b7d462dec20277088a75a0c4 (patch)
tree8153b4c67aeacbfe9d5712a8ea55a9a9d77de810 /source/blender/blenkernel/intern/armature_update.c
parentf5ea1fc4fbafbac6f648ba0d9d9ef16ca8323041 (diff)
Depsgraph: fix hard CTD on dependency cycles through POSE_INIT.
As reported in T63582, it can cause chan_array to be not ready. To reliably avoid crashing, the only easy way seems to be to create the index during COW -- maybe @sergey has a better idea.
Diffstat (limited to 'source/blender/blenkernel/intern/armature_update.c')
-rw-r--r--source/blender/blenkernel/intern/armature_update.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c
index 790f5cb2b31..892b2211bf9 100644
--- a/source/blender/blenkernel/intern/armature_update.c
+++ b/source/blender/blenkernel/intern/armature_update.c
@@ -556,8 +556,9 @@ void BKE_splineik_execute_tree(
/* *************** Depsgraph evaluation callbacks ************ */
-static void pose_pchan_index_create(bPose *pose)
+void BKE_pose_pchan_index_rebuild(bPose *pose)
{
+ MEM_SAFE_FREE(pose->chan_array);
const int num_channels = BLI_listbase_count(&pose->chanbase);
pose->chan_array = MEM_malloc_arrayN(
num_channels, sizeof(bPoseChannel *), "pose->chan_array");
@@ -605,7 +606,8 @@ void BKE_pose_eval_init(struct Depsgraph *depsgraph,
}
}
- pose_pchan_index_create(pose);
+ BLI_assert(pose->chan_array != NULL || BLI_listbase_is_empty(&pose->chanbase));
+
BKE_armature_cached_bbone_deformation_free_data(object);
}
@@ -806,7 +808,6 @@ static void pose_eval_cleanup_common(Object *object)
bPose *pose = object->pose;
BLI_assert(pose != NULL);
BLI_assert(pose->chan_array != NULL || BLI_listbase_is_empty(&pose->chanbase));
- MEM_SAFE_FREE(pose->chan_array);
}
void BKE_pose_eval_done(struct Depsgraph *depsgraph, Object *object)
@@ -839,7 +840,8 @@ void BKE_pose_eval_proxy_init(struct Depsgraph *depsgraph, Object *object)
BLI_assert(ID_IS_LINKED(object) && object->proxy_from != NULL);
DEG_debug_print_eval(depsgraph, __func__, object->id.name, object);
- pose_pchan_index_create(object->pose);
+ BLI_assert(pose->chan_array != NULL || BLI_listbase_is_empty(&pose->chanbase));
+
BKE_armature_cached_bbone_deformation_free_data(object);
}