Fix #122096: Crash after editing multi-user mesh with two scenes

In this case there are two dependency graphs, each with a separate
object containing the original mesh. Leaving edit mode modifies the
original mesh by deleting the edit mesh data. The active dependency
graph's object was tagged for that change, but the other dependency
graph didn't know about the change because its object wasn't tagged.
The solution is to tag the original mesh which will cause any
dependency graph using it to properly reevaluate.

Pull Request: https://projects.blender.org/blender/blender/pulls/128192
This commit is contained in:
Hans Goudey
2024-09-27 04:29:53 +02:00
committed by Hans Goudey
parent 7409db3e89
commit d832bf3ae4

View File

@@ -716,6 +716,8 @@ bool editmode_exit_ex(Main *bmain, Scene *scene, Object *obedit, int flag)
obedit->mode &= ~OB_MODE_EDIT;
/* Also happens when mesh is shared across multiple objects. #69834. */
DEG_id_tag_update(&obedit->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
/* Leaving edit mode may modify the original object data; tag that as well. */
DEG_id_tag_update(static_cast<ID *>(obedit->data), ID_RECALC_GEOMETRY);
}
return true;
}
@@ -738,6 +740,8 @@ bool editmode_exit_ex(Main *bmain, Scene *scene, Object *obedit, int flag)
/* also flush ob recalc, doesn't take much overhead, but used for particles */
DEG_id_tag_update(&obedit->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
/* Leaving edit mode may modify the original object data; tag that as well. */
DEG_id_tag_update(static_cast<ID *>(obedit->data), ID_RECALC_GEOMETRY);
WM_main_add_notifier(NC_SCENE | ND_MODE | NS_MODE_OBJECT, scene);