Revision: 17093
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17093
Author:   ben2610
Date:     2008-10-17 11:24:35 +0200 (Fri, 17 Oct 2008)

Log Message:
-----------
BGE bug fix (continuation of previous bug fix): 
- Forgot to make SCA_ISensor::UnregisterToManager() virtual to intercept 
active-inactive transition on collision sensor to clear colliders reference.
- Don't record collision on inactive sensor. 
  This situation occurs when an object with an inactive collision sensor 
collides with an object with an active collision sensor: the collision handler 
triggers both sensors.
  The result of this bug was pending references that eventually cause temporary 
memory leak (until the sensor is reactivated).

Modified Paths:
--------------
    trunk/blender/source/gameengine/GameLogic/SCA_ISensor.h
    trunk/blender/source/gameengine/Ketsji/KX_NearSensor.cpp
    trunk/blender/source/gameengine/Ketsji/KX_TouchSensor.cpp

Modified: trunk/blender/source/gameengine/GameLogic/SCA_ISensor.h
===================================================================
--- trunk/blender/source/gameengine/GameLogic/SCA_ISensor.h     2008-10-17 
05:54:42 UTC (rev 17092)
+++ trunk/blender/source/gameengine/GameLogic/SCA_ISensor.h     2008-10-17 
09:24:35 UTC (rev 17093)
@@ -116,8 +116,8 @@
        /** set the level detection on or off */
        void SetLevel(bool lvl);
 
-       void RegisterToManager();
-       void UnregisterToManager();
+       virtual void RegisterToManager();
+       virtual void UnregisterToManager();
 
        virtual float GetNumber();
 

Modified: trunk/blender/source/gameengine/Ketsji/KX_NearSensor.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_NearSensor.cpp    2008-10-17 
05:54:42 UTC (rev 17092)
+++ trunk/blender/source/gameengine/Ketsji/KX_NearSensor.cpp    2008-10-17 
09:24:35 UTC (rev 17093)
@@ -252,8 +252,10 @@
                        client_info->m_gameobject :
                        NULL);
        
-       // these checks are done already in BroadPhaseFilterCollision()
-       if (gameobj /*&& (gameobj != parent)*/)
+       // Add the same check as in SCA_ISensor::Activate(), 
+       // we don't want to record collision when the sensor is not active.
+       if (m_links && !m_suspended &&
+               gameobj /* done in BroadPhaseFilterCollision() && (gameobj != 
parent)*/)
        {
                if (!m_colliders->SearchValue(gameobj))
                        m_colliders->Add(gameobj->AddRef());

Modified: trunk/blender/source/gameengine/Ketsji/KX_TouchSensor.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_TouchSensor.cpp   2008-10-17 
05:54:42 UTC (rev 17092)
+++ trunk/blender/source/gameengine/Ketsji/KX_TouchSensor.cpp   2008-10-17 
09:24:35 UTC (rev 17093)
@@ -184,7 +184,10 @@
                        client_info->m_gameobject : 
                        NULL);
        
-       if (gameobj && (gameobj != parent) && client_info->isActor())
+       // add the same check as in SCA_ISensor::Activate(), 
+       // we don't want to record collision when the sensor is not active.
+       if (m_links && !m_suspended &&
+               gameobj && (gameobj != parent) && client_info->isActor())
        {
                if (!m_colliders->SearchValue(gameobj))
                        m_colliders->Add(gameobj->AddRef());


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to