Fix T59334: Crash initializing crazyspace on object with subsurf and displacement

This commit is contained in:
Sergey Sharybin 2018-12-14 16:07:29 +01:00
parent 233b780635
commit f85b05111f
Notes: blender-bot 2023-02-14 07:25:51 +01:00
Referenced by issue #59360, Baking Selected to Active crashes blender when in edit mode.
Referenced by issue #59334, Blender crashes if an object has a subdivision surface modifier and a displacement modifier linked to vertex group when switching to weight paint mode
1 changed files with 3 additions and 1 deletions

View File

@ -50,6 +50,7 @@
#include "BKE_lattice.h"
#include "BKE_library.h"
#include "BKE_mesh.h"
#include "BKE_object.h"
#include "BKE_modifier.h"
@ -190,8 +191,9 @@ Mesh *MOD_deform_mesh_eval_get(
else {
/* TODO(sybren): after modifier conversion of DM to Mesh is done, check whether
* we really need a copy here. Maybe the CoW ob->data can be directly used. */
Mesh *mesh_prior_modifiers = BKE_object_get_pre_modified_mesh(ob);
BKE_id_copy_ex(
NULL, ob->data, (ID **)&mesh,
NULL, &mesh_prior_modifiers->id, (ID **)&mesh,
(LIB_ID_CREATE_NO_MAIN |
LIB_ID_CREATE_NO_USER_REFCOUNT |
LIB_ID_CREATE_NO_DEG_TAG |