[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [61097] trunk/blender/source/gameengine/ Ketsji/KX_Scene.cpp: BGE: The recent physics cleanup was using KX_GameObject::GetParent() with out calling parent->Release().

Mitchell Stokes mogurijin at gmail.com
Mon Nov 4 20:22:52 CET 2013


Revision: 61097
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=61097
Author:   moguri
Date:     2013-11-04 19:22:52 +0000 (Mon, 04 Nov 2013)
Log Message:
-----------
BGE: The recent physics cleanup was using KX_GameObject::GetParent() with out calling parent->Release(). Since GetParent() does an AddRef(), this was causing a leak, which resulted in Zombie Object errors.

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

Modified: trunk/blender/source/gameengine/Ketsji/KX_Scene.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_Scene.cpp	2013-11-04 19:22:47 UTC (rev 61096)
+++ trunk/blender/source/gameengine/Ketsji/KX_Scene.cpp	2013-11-04 19:22:52 UTC (rev 61097)
@@ -567,11 +567,16 @@
 	{
 		PHY_IMotionState* motionstate = new KX_MotionState(newobj->GetSGNode());
 		PHY_IPhysicsController* newctrl = orgobj->GetPhysicsController()->GetReplica();
-		PHY_IPhysicsController* parentctrl = (newobj->GetParent()) ? newobj->GetParent()->GetPhysicsController() : NULL;
 
+		KX_GameObject *parent = newobj->GetParent();
+		PHY_IPhysicsController* parentctrl = (parent) ? parent->GetPhysicsController() : NULL;
+
 		newctrl->SetNewClientInfo(newobj->getClientInfo());
 		newobj->SetPhysicsController(newctrl, newobj->IsDynamic());
 		newctrl->PostProcessReplica(motionstate, parentctrl);
+
+		if (parent)
+			parent->Release();
 	}
 	return newobj;
 }




More information about the Bf-blender-cvs mailing list