BGE correction: AddRef() on source object of property actuator to protect against...
authorBenoit Bolsee <benoit.bolsee@online.be>
Sat, 22 Mar 2008 14:47:42 +0000 (14:47 +0000)
committerBenoit Bolsee <benoit.bolsee@online.be>
Sat, 22 Mar 2008 14:47:42 +0000 (14:47 +0000)
projectfiles_vc7/blender/src/BL_src.vcproj
source/gameengine/GameLogic/SCA_PropertyActuator.cpp

index 8a17fc712eb55650fae3d641e62333bca85b8ec2..4d98c52de1737c8bcfee584b67620663d2e0f417 100644 (file)
                        <File
                                RelativePath="..\..\..\source\blender\src\transform_manipulator.c">
                        </File>
+                       <File
+                               RelativePath="..\..\..\source\blender\src\transform_ndofinput.c">
+                       </File>
                        <File
                                RelativePath="..\..\..\source\blender\src\transform_numinput.c">
                        </File>
index c798503ae8abaaeb0dbab58ad18a0b3b988e3e8a..29642cd5a7b655a4010dd4c84f0626f0d1077ba9 100644 (file)
@@ -52,10 +52,16 @@ SCA_PropertyActuator::SCA_PropertyActuator(SCA_IObject* gameobj,CValue* sourceOb
        m_exprtxt(expr),
        m_sourceObj(sourceObj)
 {
+       // protect ourselves against someone else deleting the source object
+       // don't protect against ourselves: it would create a dead lock
+       if (m_sourceObj && m_sourceObj != GetParent())
+               m_sourceObj->AddRef();
 }
 
 SCA_PropertyActuator::~SCA_PropertyActuator()
 {
+       if (m_sourceObj && m_sourceObj != GetParent())
+               m_sourceObj->Release();
 }
 
 bool SCA_PropertyActuator::Update()