[Bf-blender-cvs] [d890ad37a82] blender2.8: Fix horrible invalid mesh freeing in weightvg modifiers.

Bastien Montagne noreply at git.blender.org
Mon Aug 6 11:50:19 CEST 2018


Commit: d890ad37a8268d31f3f79443b6c3b4a3c6a8b10e
Author: Bastien Montagne
Date:   Mon Aug 6 11:48:05 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBd890ad37a8268d31f3f79443b6c3b4a3c6a8b10e

Fix horrible invalid mesh freeing in weightvg modifiers.

Comes from rB7661f8a65b. Found while checking on T55818, but not solving
that issue of course.

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

M	source/blender/modifiers/intern/MOD_weightvgedit.c
M	source/blender/modifiers/intern/MOD_weightvgmix.c
M	source/blender/modifiers/intern/MOD_weightvgproximity.c

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

diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c
index a34ed1baaff..356edcd7bec 100644
--- a/source/blender/modifiers/intern/MOD_weightvgedit.c
+++ b/source/blender/modifiers/intern/MOD_weightvgedit.c
@@ -214,7 +214,9 @@ static Mesh *applyModifier(
 	}
 	/* Ultimate security check. */
 	if (!dvert) {
-		BKE_id_free(NULL, result);
+		if (result != mesh) {
+			BKE_id_free(NULL, result);
+		}
 		return mesh;
 	}
 
diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c
index b6a7228b171..3c740530258 100644
--- a/source/blender/modifiers/intern/MOD_weightvgmix.c
+++ b/source/blender/modifiers/intern/MOD_weightvgmix.c
@@ -254,7 +254,9 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
 	}
 	/* Ultimate security check. */
 	if (!dvert) {
-		BKE_id_free(NULL, result);
+		if (result != mesh) {
+			BKE_id_free(NULL, result);
+		}
 		return mesh;
 	}
 
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index 05b1ec19253..c485aa132d7 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -433,7 +433,9 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
 	}
 	/* Ultimate security check. */
 	if (!dvert) {
-		BKE_id_free(NULL, result);
+		if (result != mesh) {
+			BKE_id_free(NULL, result);
+		}
 		return mesh;
 	}



More information about the Bf-blender-cvs mailing list