[Bf-blender-cvs] [f5c0df36014] blender-v2.79a-release: Fix T53986: Crash saving during sculpt stroke

Campbell Barton noreply at git.blender.org
Thu Feb 15 05:47:37 CET 2018


Commit: f5c0df360140a807582ef8e46351414571876e10
Author: Campbell Barton
Date:   Mon Feb 5 17:53:30 2018 +1100
Branches: blender-v2.79a-release
https://developer.blender.org/rBf5c0df360140a807582ef8e46351414571876e10

Fix T53986: Crash saving during sculpt stroke

Also remove unused struct member.

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

M	source/blender/blenkernel/BKE_paint.h
M	source/blender/editors/util/ed_util.c

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

diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 64585879e5d..b436043f965 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -199,7 +199,6 @@ typedef struct SculptSession {
 	/* Layer brush persistence between strokes */
 	float (*layer_co)[3]; /* Copy of the mesh vertices' locations */
 
-	struct SculptStroke *stroke;
 	struct StrokeCache *cache;
 } SculptSession;
 
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 1f1a778cac7..7ec223a8eb9 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -168,7 +168,11 @@ bool ED_editors_flush_edits(const bContext *C, bool for_render)
 	 * exiting we might not have a context for edit object and multiple sculpt
 	 * objects can exist at the same time */
 	for (ob = bmain->object.first; ob; ob = ob->id.next) {
-		if (ob->mode & OB_MODE_SCULPT) {
+		if ((ob->mode & OB_MODE_SCULPT) &&
+		    /* Don't allow flushing while in the middle of a stroke (frees data in use).
+		     * Auto-save prevents this from happening but scripts may cause a flush on saving: T53986. */
+		    ((ob->sculpt && ob->sculpt->cache) == 0))
+		{
 			/* flush multires changes (for sculpt) */
 			multires_force_update(ob);
 			has_edited = true;



More information about the Bf-blender-cvs mailing list