Copy on write: Prevent crash when duplicating object with particle system

Transform system was using global main, which might have been pointing to a
freed scene layer.
This commit is contained in:
Sergey Sharybin
2017-07-27 16:28:16 +02:00
parent 549f43e928
commit 03d258d613

View File

@@ -5553,10 +5553,14 @@ static void set_trans_object_base_flags(TransInfo *t)
DEG_scene_relations_update(G.main, t->scene);
/* handle pending update events, otherwise they got copied below */
EvaluationContext eval_ctx;
DEG_evaluation_context_init_from_scene(&eval_ctx,
t->scene, t->scene_layer,
DAG_EVAL_VIEWPORT);
for (base = sl->object_bases.first; base; base = base->next) {
if (base->object->recalc & OB_RECALC_ALL) {
/* TODO(sergey): Ideally, it's not needed. */
BKE_object_handle_update(G.main->eval_ctx, t->scene, base->object);
BKE_object_handle_update(&eval_ctx, t->scene, base->object);
}
}