[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35606] trunk/blender/source/blender/ editors/gpencil/gpencil_paint.c: fix for using freed memory with modal grease pencil draw.

Campbell Barton ideasman42 at gmail.com
Fri Mar 18 03:44:41 CET 2011


Revision: 35606
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35606
Author:   campbellbarton
Date:     2011-03-18 02:44:40 +0000 (Fri, 18 Mar 2011)
Log Message:
-----------
fix for using freed memory with modal grease pencil draw.

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-03-18 02:09:59 UTC (rev 35605)
+++ trunk/blender/source/blender/editors/gpencil/gpencil_paint.c	2011-03-18 02:44:40 UTC (rev 35606)
@@ -1606,7 +1606,6 @@
 	if (ELEM4(event->type, RETKEY, PADENTER, ESCKEY, SPACEKEY)) {
 		/* exit() ends the current stroke before cleaning up */
 		//printf("\t\tGP - end of paint op + end of stroke\n");
-		gpencil_draw_exit(C, op);
 		p->status= GP_STATUS_DONE;
 		estate = OPERATOR_FINISHED;
 	}
@@ -1629,7 +1628,6 @@
 			}
 			else {
 				//printf("\t\tGP - end of stroke + op\n");
-				gpencil_draw_exit(C, op);
 				p->status= GP_STATUS_DONE;
 				estate = OPERATOR_FINISHED;
 			}
@@ -1642,7 +1640,6 @@
 			 */
 			if (CTX_wm_area(C) != p->sa) {
 				//printf("\t\t\tGP - wrong area execution abort! \n");
-				gpencil_draw_exit(C, op);
 				p->status= GP_STATUS_ERROR;
 				estate = OPERATOR_CANCELLED;
 			}
@@ -1656,7 +1653,6 @@
 				gp_paint_initstroke(p, p->paintmode);
 				
 				if (p->status == GP_STATUS_ERROR) {
-					gpencil_draw_exit(C, op);
 					estate = OPERATOR_CANCELLED;
 				}
 			}
@@ -1675,7 +1671,6 @@
 			/* finish painting operation if anything went wrong just now */
 			if (p->status == GP_STATUS_ERROR) {
 				//printf("\t\t\t\tGP - add error done! \n");
-				gpencil_draw_exit(C, op);
 				estate = OPERATOR_CANCELLED;
 			}
 			else {
@@ -1717,9 +1712,14 @@
 	switch (estate) {
 		case OPERATOR_FINISHED:
 			/* one last flush before we're done */
+			gpencil_draw_exit(C, op);
 			WM_event_add_notifier(C, NC_SCREEN|ND_GPENCIL|NA_EDITED, NULL); // XXX need a nicer one that will work
 			break;
 			
+		case OPERATOR_CANCELLED:
+			gpencil_draw_exit(C, op);
+			break;
+
 		case OPERATOR_RUNNING_MODAL|OPERATOR_PASS_THROUGH:
 			/* event doesn't need to be handled */
 			//printf("unhandled event -> %d (mmb? = %d | mmv? = %d)\n", event->type, event->type == MIDDLEMOUSE, event->type==MOUSEMOVE);




More information about the Bf-blender-cvs mailing list