[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40274] trunk/blender/source/gameengine/ Ketsji: BGE Animations: Fixing some refcount issues with KX_Scene:: m_animatedlist (fixes m_animatedlist crashes) and some whitespace issues with KX_GameObject::GetActionManager().

Mitchell Stokes mogurijin at gmail.com
Fri Sep 16 22:08:07 CEST 2011


Revision: 40274
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40274
Author:   moguri
Date:     2011-09-16 20:08:05 +0000 (Fri, 16 Sep 2011)
Log Message:
-----------
BGE Animations: Fixing some refcount issues with KX_Scene::m_animatedlist (fixes m_animatedlist crashes) and some whitespace issues with KX_GameObject::GetActionManager().

Modified Paths:
--------------
    trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
    trunk/blender/source/gameengine/Ketsji/KX_Scene.cpp

Modified: trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp	2011-09-16 19:51:58 UTC (rev 40273)
+++ trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp	2011-09-16 20:08:05 UTC (rev 40274)
@@ -364,7 +364,9 @@
 {
 	// We only want to create an action manager if we need it
 	if (!m_actionManager)
-	{		KX_GetActiveScene()->AddAnimatedObject(this);		m_actionManager = new BL_ActionManager(this);
+	{		
+		KX_GetActiveScene()->AddAnimatedObject(this);
+		m_actionManager = new BL_ActionManager(this);
 	}
 	return m_actionManager;
 }

Modified: trunk/blender/source/gameengine/Ketsji/KX_Scene.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_Scene.cpp	2011-09-16 19:51:58 UTC (rev 40273)
+++ trunk/blender/source/gameengine/Ketsji/KX_Scene.cpp	2011-09-16 20:08:05 UTC (rev 40274)
@@ -1034,6 +1034,8 @@
 		ret = newobj->Release();
 	if (m_euthanasyobjects->RemoveValue(newobj))
 		ret = newobj->Release();
+	if (m_animatedlist->RemoveValue(newobj))
+		ret = newobj->Release();
 		
 	if (newobj == m_active_camera)
 	{
@@ -1525,6 +1527,7 @@
 
 void KX_Scene::AddAnimatedObject(CValue* gameobj)
 {
+	gameobj->AddRef();
 	m_animatedlist->Add(gameobj);
 }
 
@@ -1537,7 +1540,7 @@
 {
 	// Update any animations
 	for (int i=0; i<m_animatedlist->GetCount(); ++i)
-		((KX_GameObject*)GetObjectList()->GetValue(i))->UpdateActionManager(curtime);
+		((KX_GameObject*)m_animatedlist->GetValue(i))->UpdateActionManager(curtime);
 }
 
 void KX_Scene::LogicUpdateFrame(double curtime, bool frame)




More information about the Bf-blender-cvs mailing list