Fix T65638: memory leak - modifiers on curves.
We need to tag the `mesh_eval` of curve as owned, when we generate one, otherwise freeing code would not free it.
This commit is contained in:
parent
8452673a01
commit
6797e80f2e
Notes:
blender-bot
2023-02-14 07:25:46 +01:00
Referenced by issue #65638, memory leak - modifiers on curves
|
@ -1159,6 +1159,10 @@ static void curve_calc_modifiers_post(Depsgraph *depsgraph,
|
|||
(*r_final) = NULL;
|
||||
}
|
||||
}
|
||||
else if (modified != NULL) {
|
||||
/* Prety stupid to generate that whole mesh if it's unused, yet we have to free it. */
|
||||
BKE_id_free(NULL, modified);
|
||||
}
|
||||
}
|
||||
|
||||
static void displist_surf_indices(DispList *dl)
|
||||
|
@ -1808,6 +1812,11 @@ void BKE_displist_make_curveTypes(
|
|||
do_makeDispListCurveTypes(
|
||||
depsgraph, scene, ob, dispbase, for_render, for_orco, &ob->runtime.mesh_eval);
|
||||
|
||||
if (ob->runtime.mesh_eval != NULL) {
|
||||
ob->runtime.mesh_eval->id.tag |= LIB_TAG_COPIED_ON_WRITE_EVAL_RESULT;
|
||||
ob->runtime.is_mesh_eval_owned = true;
|
||||
}
|
||||
|
||||
boundbox_displist_object(ob);
|
||||
}
|
||||
|
||||
|
|
|
@ -1007,6 +1007,14 @@ static void curve_to_mesh_eval_ensure(Object *object)
|
|||
&remapped_object.runtime.mesh_eval,
|
||||
false);
|
||||
|
||||
/* Note: this is to be consistent with `BKE_displist_make_curveTypes()`, however that is not a
|
||||
* real issue currently, code here is broken in more than one way, fix(es) will be done
|
||||
* separately. */
|
||||
if (remapped_object.runtime.mesh_eval != NULL) {
|
||||
remapped_object.runtime.mesh_eval->id.tag |= LIB_TAG_COPIED_ON_WRITE_EVAL_RESULT;
|
||||
remapped_object.runtime.is_mesh_eval_owned = true;
|
||||
}
|
||||
|
||||
BKE_object_free_curve_cache(&bevel_object);
|
||||
BKE_object_free_curve_cache(&taper_object);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue