[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43968] trunk/blender/source/blender/ makesrna/intern/rna_object_api.c: Fix #30089: crash with cycles viewport rendering while in text edit mode.
Brecht Van Lommel
brechtvanlommel at pandora.be
Tue Feb 7 19:08:28 CET 2012
Revision: 43968
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43968
Author: blendix
Date: 2012-02-07 18:08:15 +0000 (Tue, 07 Feb 2012)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/makesrna/intern/rna_object_api.c
Modified: trunk/blender/source/blender/makesrna/intern/rna_object_api.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_object_api.c 2012-02-07 17:42:46 UTC (rev 43967)
+++ trunk/blender/source/blender/makesrna/intern/rna_object_api.c 2012-02-07 18:08:15 UTC (rev 43968)
@@ -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 @@
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 */
More information about the Bf-blender-cvs
mailing list