[Bf-blender-cvs] [a3a7e19f078] master: Cleanup: Avoid freeing curve evaluation data twice
Hans Goudey
noreply at git.blender.org
Tue Jun 29 04:46:26 CEST 2021
Commit: a3a7e19f078432f9a139815a165ed090d8f56140
Author: Hans Goudey
Date: Mon Jun 28 21:46:12 2021 -0500
Branches: master
https://developer.blender.org/rBa3a7e19f078432f9a139815a165ed090d8f56140
Cleanup: Avoid freeing curve evaluation data twice
The curve bevel list was freed, and then freed again in a call to the
function that recalulates it. The curve "anim path" data was freed
only to be freed again in its calculation function as well. Also move
the anim_path calculation directly after the bevel list creation to
make its requirements more explicit.
===================================================================
M source/blender/blenkernel/intern/displist.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/displist.cc b/source/blender/blenkernel/intern/displist.cc
index 3048795ba45..8821da29dde 100644
--- a/source/blender/blenkernel/intern/displist.cc
+++ b/source/blender/blenkernel/intern/displist.cc
@@ -1410,13 +1410,6 @@ static void evaluate_curve_type_object(Depsgraph *depsgraph,
ListBase nubase = {nullptr, nullptr};
- BKE_curve_bevelList_free(&ob->runtime.curve_cache->bev);
-
- if (ob->runtime.curve_cache->anim_path_accum_length) {
- MEM_freeN((void *)ob->runtime.curve_cache->anim_path_accum_length);
- }
- ob->runtime.curve_cache->anim_path_accum_length = nullptr;
-
if (ob->type == OB_FONT) {
BKE_vfont_to_curve_nubase(ob, FO_EDIT, &nubase);
}
@@ -1429,6 +1422,11 @@ static void evaluate_curve_type_object(Depsgraph *depsgraph,
BKE_curve_bevelList_make(ob, &nubase, for_render);
+ if ((cu->flag & CU_PATH) ||
+ DEG_get_eval_flags_for_id(depsgraph, &ob->id) & DAG_EVAL_NEED_CURVE_PATH) {
+ BKE_anim_path_calc_data(ob);
+ }
+
/* If curve has no bevel will return nothing */
ListBase dlbev = BKE_curve_bevel_make(cu);
@@ -1439,8 +1437,8 @@ static void evaluate_curve_type_object(Depsgraph *depsgraph,
else {
const float widfac = cu->width - 1.0f;
- BevList *bl = (BevList *)ob->runtime.curve_cache->bev.first;
- Nurb *nu = (Nurb *)nubase.first;
+ const BevList *bl = (BevList *)ob->runtime.curve_cache->bev.first;
+ const Nurb *nu = (Nurb *)nubase.first;
for (; bl && nu; bl = bl->next, nu = nu->next) {
float *data;
@@ -1605,18 +1603,14 @@ static void evaluate_curve_type_object(Depsgraph *depsgraph,
}
}
}
- BKE_displist_free(&dlbev);
}
+ BKE_displist_free(&dlbev);
+
if (!(cu->flag & CU_DEFORM_FILL)) {
curve_to_filledpoly(cu, r_dispbase);
}
- if ((cu->flag & CU_PATH) ||
- DEG_get_eval_flags_for_id(depsgraph, &ob->id) & DAG_EVAL_NEED_CURVE_PATH) {
- BKE_anim_path_calc_data(ob);
- }
-
BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase);
curve_calc_modifiers_post(
depsgraph, scene, ob, r_dispbase, for_render, force_mesh_conversion, r_final);
More information about the Bf-blender-cvs
mailing list