Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMitchell Stokes <mogurijin@gmail.com>2012-02-14 11:54:12 +0400
committerMitchell Stokes <mogurijin@gmail.com>2012-02-14 11:54:12 +0400
commit6905d0d92b7f2faf0d9d26a17f495a663908ec69 (patch)
treee17ddba82685ed576b45ea7934b41632d282741f /source
parent441dc0fc7ec0c333a4d2fa16a4ec5c72d471a644 (diff)
Fixing up some buggy cleanup code in BL_ShapeDeformer. This code was causing crashes and corrupting shape keys. This commit fixes the following bugs:
[#30059] Shape Keys is gone in Blender if you use Add Object Actuator in BGE [#30024] Segmentation fault after addObject when using shape keys [#28683] segfault in shapekey conversion code when running a game (YF, level home) twice
Diffstat (limited to 'source')
-rw-r--r--source/gameengine/Converter/BL_ShapeDeformer.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/gameengine/Converter/BL_ShapeDeformer.cpp b/source/gameengine/Converter/BL_ShapeDeformer.cpp
index fb0a86d6084..bb3636881ea 100644
--- a/source/gameengine/Converter/BL_ShapeDeformer.cpp
+++ b/source/gameengine/Converter/BL_ShapeDeformer.cpp
@@ -50,6 +50,8 @@
#include "DNA_meshdata_types.h"
#include "BKE_armature.h"
#include "BKE_action.h"
+#include "BKE_global.h"
+#include "BKE_main.h"
#include "BKE_key.h"
#include "BKE_ipo.h"
#include "MT_Point3.h"
@@ -97,10 +99,13 @@ BL_ShapeDeformer::BL_ShapeDeformer(BL_DeformableGameObject *gameobj,
BL_ShapeDeformer::~BL_ShapeDeformer()
{
- if (m_key && m_bmesh->key)
+ if (m_key && m_bmesh->key && m_key != m_bmesh->key)
{
free_key(m_bmesh->key);
+ BLI_remlink_safe(&G.main->key, m_bmesh->key);
+ MEM_freeN(m_bmesh->key);
m_bmesh->key = m_key;
+ m_key = NULL;
}
};