Commit: f43fb3ee82ea74fd3c0271f06d29e3392502c91e
Author: Grigory Revzin
Date:   Sat Jul 19 02:41:37 2014 +0400
https://developer.blender.org/rBf43fb3ee82ea74fd3c0271f06d29e3392502c91e

Fixed a bad crash while switching shapekeys with topo changes

Turned out to be a memory corruption issue due to a stupid 'premature
optimization' attempt, used Valgrind to figure out where that was.

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

M       source/blender/editors/mesh/editmesh_utils.c

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

diff --git a/source/blender/editors/mesh/editmesh_utils.c 
b/source/blender/editors/mesh/editmesh_utils.c
index 5db76b6..6166db9 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -624,12 +624,12 @@ void EDBM_update_scratch_from_active(Object *ob)
        KeyBlock *neworigin = BKE_keyblock_from_object(ob);
 
        k->scratch.origin = neworigin;
-       if (oldorigin->totelem != neworigin->totelem) {
-               if (k->scratch.data) {
-                       MEM_freeN(k->scratch.data);
-                       k->scratch.data = MEM_mallocN(sizeof(float) * 3 * 
neworigin->totelem, __func__);
-               }
+       
+       if (k->scratch.data) {
+               MEM_freeN(k->scratch.data);
+               k->scratch.data = MEM_mallocN(sizeof(float)* 3 * 
neworigin->totelem, __func__);
        }
+
        /* neworigin -> scratch */
        BLI_assert(neworigin->totelem == 
BKE_editmesh_from_object(ob)->bm->totvert);
        memcpy(k->scratch.data, neworigin->data, sizeof(float) * 3 * 
neworigin->totelem);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to