[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44103] trunk/blender/source/gameengine/ Converter/BL_ShapeDeformer.cpp: Fixing up some buggy cleanup code in BL_ShapeDeformer.

Mitchell Stokes mogurijin at gmail.com
Tue Feb 14 08:54:13 CET 2012


Revision: 44103
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44103
Author:   moguri
Date:     2012-02-14 07:54:12 +0000 (Tue, 14 Feb 2012)
Log Message:
-----------
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

Modified Paths:
--------------
    trunk/blender/source/gameengine/Converter/BL_ShapeDeformer.cpp

Modified: trunk/blender/source/gameengine/Converter/BL_ShapeDeformer.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_ShapeDeformer.cpp	2012-02-14 07:47:29 UTC (rev 44102)
+++ trunk/blender/source/gameengine/Converter/BL_ShapeDeformer.cpp	2012-02-14 07:54:12 UTC (rev 44103)
@@ -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()
 {
-	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;
 	}
 };
 




More information about the Bf-blender-cvs mailing list