[Bf-blender-cvs] [d607688f968] greasepencil-object: Fix segfault error when drawing several strokes in same drawing session

Antonio Vazquez noreply at git.blender.org
Tue May 16 19:25:18 CEST 2017


Commit: d607688f968722882bfc581ba21a9faaa69d701d
Author: Antonio Vazquez
Date:   Tue May 16 19:25:07 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rBd607688f968722882bfc581ba21a9faaa69d701d

Fix segfault error when drawing several strokes in same drawing session

The clean of the cache must be done by stroke and not at the final of the drawing session.

===================================================================

M	source/blender/editors/gpencil/gpencil_paint.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index d30fb911e30..c8dbf108def 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -185,6 +185,10 @@ static void gp_stroke_added_enable(tGPsdata *p)
 {
 	BLI_assert(p->gpf->strokes.last != NULL);
 	p->flags |= GP_PAINTFLAG_STROKEADDED;
+
+	/* drawing batch cache is dirty now */
+	BKE_gpencil_batch_cache_free(p->gpd);
+	p->gpd->flag |= GP_DATA_CACHE_IS_DIRTY;
 }
 
 /* ------ */
@@ -1963,9 +1967,6 @@ static void gpencil_draw_exit(bContext *C, wmOperator *op)
 		gp_paint_cleanup(p);
 		gp_session_cleanup(p);
 
-		/* drawing batch cache is dirty now */
-		BKE_gpencil_batch_cache_free(p->gpd);
-		p->gpd->flag |= GP_DATA_CACHE_IS_DIRTY;
 		/* finally, free the temp data */
 		MEM_freeN(p);
 	}




More information about the Bf-blender-cvs mailing list