diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-03-22 17:47:42 +0300 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-03-22 17:47:42 +0300 |
commit | 6615f8b74f5f959ccae5a33aeae90b37b3cd511b (patch) | |
tree | 36c6692edf3959ba4226c6e965ec50069fb68a85 | |
parent | 1d0e1d5406a6603d629d7284418996cd19d0202f (diff) |
BGE correction: AddRef() on source object of property actuator to protect against crash if the source object is deleted (bad game design anyway)
-rw-r--r-- | projectfiles_vc7/blender/src/BL_src.vcproj | 3 | ||||
-rw-r--r-- | source/gameengine/GameLogic/SCA_PropertyActuator.cpp | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/projectfiles_vc7/blender/src/BL_src.vcproj b/projectfiles_vc7/blender/src/BL_src.vcproj index 8a17fc712eb..4d98c52de17 100644 --- a/projectfiles_vc7/blender/src/BL_src.vcproj +++ b/projectfiles_vc7/blender/src/BL_src.vcproj @@ -548,6 +548,9 @@ 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> <File diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp index c798503ae8a..29642cd5a7b 100644 --- a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp +++ b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp @@ -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() |