diff options
Diffstat (limited to 'source/gameengine/GameLogic/SCA_PropertyActuator.cpp')
-rw-r--r-- | source/gameengine/GameLogic/SCA_PropertyActuator.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
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() |