diff options
author | Sergey Sharybin <sergey@blender.org> | 2020-09-07 17:43:34 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2020-09-07 17:44:18 +0300 |
commit | 231d08cbb11277ebfe1c1700124ced9ef50229d8 (patch) | |
tree | 82ddb1b4de6eb177afde10aa5a9adfeaaffc9288 | |
parent | 9681708c1cf12026095b3a8a52cd0b3fa046ba1f (diff) |
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.
-rw-r--r-- | source/blender/modifiers/intern/MOD_multires.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index 7bdc1da33c2..03e7f0a235b 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -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 { |