diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-02-07 22:08:15 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-02-07 22:08:15 +0400 |
commit | acb796c623700c8a869e602467bd650ebc02b6ce (patch) | |
tree | e08a87a585ee514a4c1a1e4337a6a87fdfddf876 /source/blender/makesrna/intern/rna_object_api.c | |
parent | 4a427a441b37ad0539e3c758b31a384edf8b7c76 (diff) |
Fix #30089: crash with cycles viewport rendering while in text edit mode.
Cause was Object.to_mesh(), which could cause invalid memory access when
calling it on text objects in edit mode.
Diffstat (limited to 'source/blender/makesrna/intern/rna_object_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_object_api.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index 188ccccbfc4..9a90499d7df 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -80,7 +80,7 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_modifiers, int settings) { Mesh *tmpmesh; - Curve *tmpcu = NULL; + Curve *tmpcu = NULL, *copycu; Object *tmpobj = NULL; int render = settings == eModifierMode_Render, i; int cage = !apply_modifiers; @@ -101,22 +101,20 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_ object_free_modifiers(tmpobj); /* copies the data */ - tmpobj->data = copy_curve( (Curve *) ob->data ); + copycu = tmpobj->data = copy_curve( (Curve *) ob->data ); -#if 0 - /* copy_curve() sets disp.first null, so currently not need */ - { - Curve *cu; - cu = (Curve *)tmpobj->data; - if( cu->disp.first ) - MEM_freeN( cu->disp.first ); - cu->disp.first = NULL; - } - -#endif + /* temporarily set edit so we get updates from edit mode, but + also because for text datablocks copying it while in edit + mode gives invalid data structures */ + copycu->editfont = tmpcu->editfont; + copycu->editnurb = tmpcu->editnurb; /* get updated display list, and convert to a mesh */ makeDispListCurveTypes( sce, tmpobj, 0 ); + + copycu->editfont = NULL; + copycu->editnurb = NULL; + nurbs_to_mesh( tmpobj ); /* nurbs_to_mesh changes the type to a mesh, check it worked */ |