[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16245] trunk/blender/source/gameengine/ Ketsji/KX_SCA_AddObjectActuator.cpp: getting the last created object would return an object that had no SG_Node which would crash whenever python tried to get its location .
Campbell Barton
ideasman42 at gmail.com
Mon Aug 25 11:52:38 CEST 2008
Revision: 16245
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16245
Author: campbellbarton
Date: 2008-08-25 11:52:38 +0200 (Mon, 25 Aug 2008)
Log Message:
-----------
getting the last created object would return an object that had no SG_Node which would crash whenever python tried to get its location.
since the object was removed from the scene anyway, there is no reason to return it.
Modified Paths:
--------------
trunk/blender/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
Modified: trunk/blender/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp 2008-08-25 06:22:21 UTC (rev 16244)
+++ trunk/blender/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp 2008-08-25 09:52:38 UTC (rev 16245)
@@ -377,7 +377,10 @@
PyObject* kwds)
{
SCA_IObject* result = this->GetLastCreatedObject();
- if (result)
+
+ // if result->GetSGNode() is NULL
+ // it means the object has ended, The BGE python api crashes in many places if the object is returned.
+ if (result && (static_cast<KX_GameObject *>(result))->GetSGNode())
{
result->AddRef();
return result;
More information about the Bf-blender-cvs
mailing list