tornavis/source/blender/editors/armature
Sergey Sharybin 87a98c361c Fix: Crash when parenting mesh to armature with automatic weights
There probably are more cases where crash will happen as it is
rooting into the issue with BKE_object_workob_calc_parent() which
is used in multiple places.

The issue is caused by the access to a runtime field of workob
outside of the BKE_object_workob_calc_parent(): the runtime field
is stack-allocated in the function, and can not be accessed outside
of the function.

The easiest way to reproduce is to use ASAN, and parent mesh to an
armature with automatic weights. Although, on macOS ASAN did not
report issues, so setting workob->runtime to nullptr at the end of
of the BKE_object_workob_calc_parent() was the easiest.

The solution is simple: make the function to return the matrix,
and take care of the working object inside of it, so all tricky
parts are hidden from the API.

The patch is targeting the main branch, as in 4.1 it is not
required to do such change because all uses of the function only
access object_to_world, which is stored in the object in 4.1.

A double-check in the what_does_obaction() might be needed as it
follows the similar pattern, but it does not seem that runtime
field of the workob is accessed in usages of the what_does_obaction().

Pull Request: https://projects.blender.org/blender/blender/pulls/118847
2024-02-28 15:06:02 +01:00
..
CMakeLists.txt Cleanup: Move armature_intern.h to C++ 2024-01-24 11:46:39 -05:00
armature_add.cc Object: Move transform matrices to runtime struct 2024-02-14 16:14:49 +01:00
armature_edit.cc Despgraph: Rename "copy-on-write" to "copy-on-evaluation" 2024-02-19 15:54:08 +01:00
armature_intern.hh Cleanup: Return Vector for View Layer objects and bases retrieval 2024-01-24 18:18:14 +01:00
armature_naming.cc Despgraph: Rename "copy-on-write" to "copy-on-evaluation" 2024-02-19 15:54:08 +01:00
armature_ops.cc Cleanup: Move armature_intern.h to C++ 2024-01-24 11:46:39 -05:00
armature_relations.cc Cleanup: Move `BKE_anim_data` header to be fully C++. 2024-02-28 11:51:03 +01:00
armature_select.cc Despgraph: Rename "copy-on-write" to "copy-on-evaluation" 2024-02-19 15:54:08 +01:00
armature_skinning.cc Object: Move transform matrices to runtime struct 2024-02-14 16:14:49 +01:00
armature_utils.cc Cleanup: unused headers for source/blender/editors 2024-02-13 10:02:53 +11:00
bone_collections.cc Despgraph: Rename "copy-on-write" to "copy-on-evaluation" 2024-02-19 15:54:08 +01:00
editarmature_undo.cc Anim: bone collections, store expanded/collapsed state in DNA 2024-02-02 12:28:22 +01:00
meshlaplacian.cc Object: Move transform matrices to runtime struct 2024-02-14 16:14:49 +01:00
meshlaplacian.h Clang Format: bump to version 17 2024-01-03 13:38:14 +01:00
pose_edit.cc Despgraph: Rename "copy-on-write" to "copy-on-evaluation" 2024-02-19 15:54:08 +01:00
pose_lib_2.cc Cleanup: Move `BKE_anim_data` header to be fully C++. 2024-02-28 11:51:03 +01:00
pose_select.cc Despgraph: Rename "copy-on-write" to "copy-on-evaluation" 2024-02-19 15:54:08 +01:00
pose_slide.cc Cleanup: unused headers for source/blender/editors 2024-02-13 10:02:53 +11:00
pose_transform.cc Fix: Crash when parenting mesh to armature with automatic weights 2024-02-28 15:06:02 +01:00
pose_utils.cc Cleanup: Move `BKE_anim_data` header to be fully C++. 2024-02-28 11:51:03 +01:00