Fix #141626: Refcount error when (un)assigning custom bone shapes
Fix the ID user count when changing `posebone.custom_shape`. The code uses `reinterpret_cast<ID *>(pchan->custom)` instead of `&pchan->custom->id`, as the former is `nullptr`-safe. Pull Request: https://projects.blender.org/blender/blender/pulls/141726
This commit is contained in:
@@ -645,6 +645,7 @@ void rna_Pose_custom_shape_set(PointerRNA *ptr, PointerRNA value, struct ReportL
|
||||
Object *custom_shape = static_cast<Object *>(value.data);
|
||||
|
||||
if (!custom_shape) {
|
||||
id_us_min(reinterpret_cast<ID *>(pchan->custom));
|
||||
pchan->custom = nullptr;
|
||||
return;
|
||||
}
|
||||
@@ -657,7 +658,9 @@ void rna_Pose_custom_shape_set(PointerRNA *ptr, PointerRNA value, struct ReportL
|
||||
return;
|
||||
}
|
||||
|
||||
id_us_min(reinterpret_cast<ID *>(pchan->custom));
|
||||
pchan->custom = custom_shape;
|
||||
id_us_plus(reinterpret_cast<ID *>(pchan->custom));
|
||||
}
|
||||
|
||||
bool rna_Pose_custom_shape_object_poll(PointerRNA * /*ptr*/, PointerRNA value)
|
||||
|
||||
Reference in New Issue
Block a user