Multires: Fix memory leak when multires is at level 0
There is no SubdivCCG created in this case, meaning ownership of the Subdiv was not altered.
This commit is contained in:
parent
9681708c1c
commit
231d08cbb1
|
@ -205,6 +205,13 @@ static Mesh *multires_as_ccg(MultiresModifierData *mmd,
|
|||
}
|
||||
BKE_subdiv_displacement_attach_from_multires(subdiv, mesh, mmd);
|
||||
result = BKE_subdiv_to_ccg_mesh(subdiv, &ccg_settings, mesh);
|
||||
|
||||
/* NOTE: CCG becomes an owner of Subdiv descriptor, so can not share
|
||||
* this pointer. Not sure if it's needed, but might have a second look
|
||||
* on the ownership model here. */
|
||||
MultiresRuntimeData *runtime_data = mmd->modifier.runtime;
|
||||
runtime_data->subdiv = NULL;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -261,10 +268,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
|
|||
sculpt_session->mpoly = NULL;
|
||||
sculpt_session->mloop = NULL;
|
||||
}
|
||||
/* NOTE: CCG becomes an owner of Subdiv descriptor, so can not share
|
||||
* this pointer. Not sure if it's needed, but might have a second look
|
||||
* on the ownership model here. */
|
||||
runtime_data->subdiv = NULL;
|
||||
// BKE_subdiv_stats_print(&subdiv->stats);
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue