Fix #125157: Sculpt multires crashes on box mask and duplicated stroke

Introduced in d527e3a6bd.

The change to update PBVH normals before destroying the PBVH to fix
shading on duplicate meshes issues had the unfortunate side effect of
causing crashes for multires due to a race condition. This commit
simply avoids performing this flushing for multires to allow for
further iteration in the future instead of reverting the offending
commit entirely.

Pull Request: https://projects.blender.org/blender/blender/pulls/125268
This commit is contained in:
Sean Kim
2024-07-23 22:56:26 +02:00
committed by Sean Kim
parent 7daefd730b
commit 338140f1e6

View File

@@ -2046,7 +2046,10 @@ void BKE_sculpt_update_object_before_eval(Object *ob_eval)
if (ss && ss->building_vp_handle == false) {
if (!ss->cache && !ss->filter_cache && !ss->expand_cache) {
if (ss->pbvh) {
/* Avoid performing the following normal update for Multires, as it causes race conditions
* and other intermittent crashes with shared meshes.
* See !125268 and #125157 for more information. */
if (ss->pbvh && ss->pbvh->type() != blender::bke::pbvh::Type::Grids) {
/* pbvh::Tree nodes may contain dirty normal tags. To avoid losing that information when
* the pbvh::Tree is deleted, make sure all tagged geometry normals are up to date.
* See #122947 for more information. */