diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-02-14 09:21:55 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-02-14 09:21:55 +0300 |
commit | 6074f62d1a099fc378aa25506a93321dba2d956b (patch) | |
tree | becbb4abdb6c9c9a047c1a6f5d5c94c53e56ff50 /source/blender/blenkernel/intern/curve.c | |
parent | caa8e7ff2894ed22ea436bc61b06fb292d844108 (diff) |
Fix T61353: Crash converting a curve to a mesh
This was caused by curves pointing to each other
creating a cyclic dependency.
While the dependency graph detects this, generating a mesh for render
recursively generates data which cashes in this case.
Add in a check to detect cyclic links.
Note, this bug exists in 2.7x too - but only crashes on render
since 2.7x didn't use 'for_render' when converting data.
Diffstat (limited to 'source/blender/blenkernel/intern/curve.c')
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 8bb47a6a69b..3be101134ec 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -31,6 +31,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" #include "BLI_ghash.h" +#include "BLI_linklist.h" #include "DNA_anim_types.h" #include "DNA_curve_types.h" @@ -1735,7 +1736,7 @@ float *BKE_curve_make_orco(Depsgraph *depsgraph, Scene *scene, Object *ob, int * float *fp, *coord_array; ListBase disp = {NULL, NULL}; - BKE_displist_make_curveTypes_forOrco(depsgraph, scene, ob, &disp); + BKE_displist_make_curveTypes_forOrco(depsgraph, scene, ob, &disp, NULL); numVerts = 0; for (dl = disp.first; dl; dl = dl->next) { @@ -1828,7 +1829,8 @@ float *BKE_curve_make_orco(Depsgraph *depsgraph, Scene *scene, Object *ob, int * void BKE_curve_bevel_make( Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *disp, - const bool for_render, const bool use_render_resolution) + const bool for_render, const bool use_render_resolution, + LinkNode *ob_cyclic_list) { DispList *dl, *dlnew; Curve *bevcu, *cu; @@ -1852,8 +1854,15 @@ void BKE_curve_bevel_make( facy = cu->bevobj->size[1]; if (for_render) { - BKE_displist_make_curveTypes_forRender(depsgraph, scene, cu->bevobj, &bevdisp, NULL, false, use_render_resolution); - dl = bevdisp.first; + if (BLI_linklist_index(ob_cyclic_list, cu->bevobj) == -1) { + BKE_displist_make_curveTypes_forRender( + depsgraph, scene, cu->bevobj, &bevdisp, NULL, false, use_render_resolution, + &(LinkNode){ .link = ob, .next = ob_cyclic_list, }); + dl = bevdisp.first; + } + else { + dl = NULL; + } } else if (cu->bevobj->runtime.curve_cache) { dl = cu->bevobj->runtime.curve_cache->disp.first; |