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:
authorAndrew Oates <aoates>2022-09-29 11:17:22 +0300
committerSergey Sharybin <sergey@blender.org>2022-09-29 11:35:18 +0300
commit4bdba62cb94978c94d29150d2fd426ca18aa8d0d (patch)
treef3cca8f09238037f75bd2797353561d5b36b29a9 /source/blender/editors/object/object_relations.c
parent039429faeb4160cc26b283c7309c9cb9d87ee7c0 (diff)
Fix T94441: fix crash parenting object to a bone
This crash occurs when the bone is newly created. In certain circumstances the depsgraph data for the armature is not updated, causing `pchan_eval` to be NULL when the parent is updated. This causes a segfault in `ED_object_parent_set` when the flags are updated. This change fixes the underlying depsgraph bug, and also adds both an assertion and NULL pointer check to `ED_object_parent_set` to better handle this scenario if it recurs via another path. Maniphest Tasks: T94441 Differential Revision: https://developer.blender.org/D16065
Diffstat (limited to 'source/blender/editors/object/object_relations.c')
-rw-r--r--source/blender/editors/object/object_relations.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 21e56531096..2f18922f4ee 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -570,7 +570,9 @@ bool ED_object_parent_set(ReportList *reports,
pchan = BKE_pose_channel_active_if_layer_visible(par);
pchan_eval = BKE_pose_channel_active_if_layer_visible(parent_eval);
- if (pchan == NULL) {
+ if (pchan == NULL || pchan_eval == NULL) {
+ /* If pchan_eval is NULL, pchan should also be NULL. */
+ BLI_assert_msg(pchan == NULL, "Missing evaluated bone data");
BKE_report(reports, RPT_ERROR, "No active bone");
return false;
}