Clean-up/safety check in new BKE_mesh_copy_settings().
From rBe7a514369fe70, since I did not have time to do proper review in D5808... Note that we could also consider that shallow copy of src should never be dst of that function and add some asserts instead. For now going the safest and simplest way though.
This commit is contained in:
parent
7a78bc5d24
commit
658d7eeed2
|
@ -672,7 +672,7 @@ void BKE_mesh_copy_settings(Mesh *me_dst, const Mesh *me_src)
|
|||
|
||||
/* Copy texture space. */
|
||||
me_dst->texflag = me_src->texflag;
|
||||
if (me_dst->bb) {
|
||||
if (me_dst->bb != NULL && me_dst->bb != me_src->bb) {
|
||||
MEM_freeN(me_dst->bb);
|
||||
}
|
||||
me_dst->bb = MEM_dupallocN(me_src->bb);
|
||||
|
@ -681,7 +681,7 @@ void BKE_mesh_copy_settings(Mesh *me_dst, const Mesh *me_src)
|
|||
copy_v3_v3(me_dst->size, me_src->size);
|
||||
|
||||
/* Copy materials. */
|
||||
if (me_dst->mat != NULL) {
|
||||
if (me_dst->mat != NULL && me_dst->mat != me_src->mat) {
|
||||
MEM_freeN(me_dst->mat);
|
||||
}
|
||||
me_dst->mat = MEM_dupallocN(me_src->mat);
|
||||
|
|
Loading…
Reference in New Issue