[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39237] trunk/blender/source/blender/ editors/gpencil/gpencil_paint.c: fix for crash undoing grease pencil session, last action would free entire frame which the session held a reference to.

Campbell Barton ideasman42 at gmail.com
Tue Aug 9 23:32:47 CEST 2011


Revision: 39237
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39237
Author:   campbellbarton
Date:     2011-08-09 21:32:46 +0000 (Tue, 09 Aug 2011)
Log Message:
-----------
fix for crash undoing grease pencil session, last action would free entire frame which the session held a reference to.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/gpencil/gpencil_paint.c

Modified: trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
===================================================================
--- trunk/blender/source/blender/editors/gpencil/gpencil_paint.c	2011-08-09 21:04:52 UTC (rev 39236)
+++ trunk/blender/source/blender/editors/gpencil/gpencil_paint.c	2011-08-09 21:32:46 UTC (rev 39237)
@@ -1728,7 +1728,12 @@
 				/* just delete last stroke, which will look like undo to the end user */
 				//printf("caught attempted undo event... deleting last stroke \n");
 				gpencil_frame_delete_laststroke(p->gpl, p->gpf);
-				
+				/* undoing the last line can free p->gpf
+				 * note, could do this in a bit more of an elegant way then a search but it at least prevents a crash */
+				if(BLI_findindex(&p->gpl->frames, p->gpf) == -1) {
+					p->gpf= NULL;
+				}
+
 				/* event handled, so force refresh */
 				ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */
 				estate = OPERATOR_RUNNING_MODAL; 




More information about the Bf-blender-cvs mailing list